每当宝石NoMethodError

时间:2014-10-14 02:10:50

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

我正在尝试制作一种每天在特定时间发送电子邮件的功能。 我正在使用带有导轨4的每当宝石,但我无法使其工作。

**schedule.rb**
     every 4.days do
        runner "User.reporting"
     end

**User.rb**
     def self.reporting
       users_size = 1
       ReportsMailer.reporting_users(users_size).deliver
     end

在终端显示“when --update-crontab”和“when”后运行:

    0 0 1,5,9,13,17,21,25,29 * * /bin/bash -l -c 'cd /var/homes/HS && bin/rails runner -e production '\''User.reporting'\'''

    ## [message] Above is your schedule file converted to cron syntax; your crontab file was not updated.
    ## [message] Run `whenever --help' for more options.
    You have new mail in /var/spool/mail/root

重新启动 crond 时,我正在运行终端:

    /bin/bash -l -c 'cd /var/homes/HS && bin/rails runner -e production '\''User.reporting'\'''

我明白了:

    /usr/local/rvm/gems/ruby-2.0.0-p451/gems/railties-4.0.0/lib/rails/commands/runner.rb:53:in `eval': undefined method `reporting' for #<Class:0xc0028bc> (NoMethodError)

此后不仅邮件正在运行,而且我的facebook_omniauth给我一个self.user_count_signin函数的错误:

    NoMethodError (private method `user_count_signin' called for #<User:0xc1549b8>):


app/controllers/access_controller.rb:58:in `facebook_connect'

这是在生产环境中。

0 个答案:

没有答案