Rails bunnies task only in production
I have a task defined in crons.rake
but this task only runs in production mode. how can i start this mode in dev mode?
task(:generate_mindmails => :environment) do
I suggest you use pearl instead whenever
. It can be adjusted more comfortably. Like this:
every 5.hours do
runner "MyModel.my_method", :environment => :development
end
You can install it by adding it gem 'whenever'
to yours Gemfile
and then run it bundle install
. You should read the documentation or at least README.md
the github project.
// You can also run it in both environments:
every 5.hours do
runner "MyModel.my_method", :environment => :development
runner "MyModel.my_method", :environment => :production
end
Just install the environment before running the command:
$ RAILS_ENV=development rake generate_mindmails