Monday 29 April 2013

how to run a scheduler.rake file in rails?



If you don't see your command in the response list then it is not well formed or just does not have description. So you need to investigate your rake file. Rake tasks files have similar structure, like:

namespace :some_task do

  task :do_some_work => :environment do
    # Code goes here
  end

  desc 'Do some other work'
  task :do_something => :environment do
    # Code goes here
  end

end

#first task
rake some_task:do_some_work

#second task
rake some_task:do_something

Sometimes there could be no namespace and then tasks could be executed just using rake command and name of the task as first argument.

No comments:

Post a Comment