使用Whenever Gem进行耙任务

时间:2016-05-17 09:00:20

标签: ruby-on-rails ruby-on-rails-4

我想每周每月和每月发送电子邮件,相应地选择用户。我怎么能在gem时使用它。

以下是我的佣金文件:

every 4.hours do
    rake "send_trending_deals:email_trending_deals"
end

Schedule.rb:

<div class="col-sm-4">
    <img src="*insert image*" class="img-responsive" data-toggle="modal" data-target=".lightbox"/>
        <div class="modal lightbox" tabindex="-1" role="dialog">
            <div class="modal-dialog modal-lg">
                <div class="modal-content">
                    <img src="*insert image*" class="img-responsive"/>
                </div>
            </div>
       </div>
</div>

1 个答案:

答案 0 :(得分:1)

每日

every :day, at: '10:00' do
   #run task
end

每周

every :sunday, at: '13:00' do
   #run task
end

每月

every :month, at: '12:00' do
   #run task
end