0

控制器:

    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 分钟后,跑步者无法调用模型方法。

4

1 回答 1

0

Have you updated the crontab with the jobs in schedule.rb file.

Update the crontab with the following command

whenever --update-crontab --set environment=development

If you updated properly, then can u please past the jobs of crontab.

You can get the crontab jobs by crontab -l. And also check the log file for any error messages.

于 2013-03-19T11:32:52.970 回答