Rails bunnies task only in production
2 answers
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
+4
source to share