Created
June 22, 2012 18:05
-
-
Save danieltahara/2974276 to your computer and use it in GitHub Desktop.
practice rake file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
task :greet do | |
puts "hello" | |
end | |
task :ask => [:greet, :question] do | |
puts "how are you?" | |
end | |
task :question do | |
puts "who are you?" | |
end | |
namespace :pick do | |
desc "picks a random user and prints email" | |
task :winner => :environment do | |
user = User.find(:first, :order => 'RAND()') | |
puts user.email | |
end | |
task :devices => :environment do | |
devices = User.find(:first, :order => 'RAND()').devices | |
puts devices | |
end | |
def pick(model_class) | |
model_calss.find(:first, :order => 'RAND()') | |
end | |
end | |
task :all => [:ask] | |
task :default => :all |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment