Friday, August 17, 2012

Customize a new rake task in rails


Refer to lib/task/*.rake 
Arguments can be passed by using of ENV.
e.g.
desc "create csv of loan ledgers: LEDGERS_START_DATE=2011-07-01 LEDGERS_END_DATE=2011-12-31 rake adhoc:ledgers"
task :ledgers => :environment do
Adhocs.create_csv_of_loan_ledgers(ENV['LEDGERS_START_DATE'], ENV['LEDGERS_END_DATE'])
end

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.