控制器:
class CronjobsController < ApplicationController
def just_check
meeting_id = 1
UserMailer.upcoming_meeting_email_twelve_hours_before(meeting_id).deliver
end
end
模型:
class Cronjob < ActiveRecord::Base
def self.just_check
meeting_id = "meeting.id"
UserMailer.upcoming_meeting_email_twelve_hours_before(meeting_id).deliver
end
end
日程安排.rb
every 2.minute do
runner "Cronjob.just_check", :environment => "development"
end
但问题是每2 分钟后,跑步者无法调用模型方法。