Skip to content

Instantly share code, notes, and snippets.

@adam-phillipps
Created June 10, 2013 16:26
Show Gist options
  • Save adam-phillipps/5750104 to your computer and use it in GitHub Desktop.
Save adam-phillipps/5750104 to your computer and use it in GitHub Desktop.
script to register users
Dir.chdir("~/code/scripts")
2 puts script/runner
3 puts register.rb
4 end
5
6
7 def register_users()
8 (81..300).each.do |i|
9 User.find_by_id(i).update_attributes({workflow_state => 'active'})
10 puts "Progress at: #{i}"
11 end
12 end
13
14 #def register_users()
15 # (81..300).each {|i| User.find_by_id(i).update_attributes({:workflow_state => 'active'})}
16 #end
@jakesorce
Copy link

so if you wanted script/runner to run that script it would just be:

bundle exec script/runner register.rb in the root of your canvas directory

and your script would look like this:

def register_users()
(81..300).each do |i|
User.find_by_id(i).update_attribute(workflow_state, 'active')
puts "Progress at: #{i}"
end
end

@jakesorce
Copy link

def register_users()
(81..300).each do |i|
User.find_by_id(i).update_attribute(:workflow_state, 'active')
puts "Progress at: #{i}"
end
end

@jakesorce
Copy link

def register_users()
(81..300).each { |i| User.find_by_id(i).update_attribute(:workflow_state, 'active') }
end

@jakesorce
Copy link

(81..300).each { |i| User.find_by_id(i).update_attribute(:workflow_state, 'active') }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment