【发布时间】:2018-06-14 04:01:07
【问题描述】:
文章控制器中有一堆邮件方法,它们将不同类型的文章与不同的用户混合在一起。从 Rails 中的某个地方调用时,一切正常。但它们需要在一周内由 cron 执行。 rake 文件中的“xxxx”用什么代替来告诉它在 Article 控制器中执行“10_am_action”方法?
articles_controller.rb:
def 10_am_action
[sends the right e-mails to the right users]
end
Cron:
0 10 * * 0 cd /data/website/current && RAILS_ENV=production bundle exec rake emails:10_am
emails.rake:
namespace :briefings do
desc "10 am e-mails"
task :10_am => :environment do
xxxxxx
end
end
【问题讨论】:
标签: ruby-on-rails ruby model-view-controller cron rake