请大家看一下为什么我调用的ActionMailer总是说方法未定义那

我的运行环境是rails 1.2.5 actionmailer 是1.3; 我用 ./script/generate mailer FinanceMailer alert_customer_balance 的命令生成了相应的程序;

class FinanceMailer < ActionMailer::Base

def alert_customer_balance(sent_at = Time.now)
@subject = 'FinanceMailer#alert_customer_balance'
@body = {}
@recipients = 'qiang.zhou@qunar.com'
@from = 'qiang.zhou@qunar.com'
@sent_on = sent_at
@headers = {}
end
end

然后我写了一段用命令行调用代码如下:

require File.expand_path(File.dirname(__FILE__) + "/../config/environment")

if __FILE__ == $0
FinanceMailer.alert_customer_balance()
end

但是我运行这段代码总是有这个问题:
D:\ruby-projects\adwords\jobs>ruby daily_finance_alert.rb
D:/ruby-projects/adwords/config/boot.rb:20:Warning: Gem::SourceIndex#search supp
ort for String patterns is deprecated
c:/ruby/lib/ruby/gems/1.8/gems/actionmailer-1.3.5/lib/action_mailer/base.rb:335:
in `method_missing': undefined method `alert_customer_balance' for FinanceMailer
:Class (NoMethodError)
from daily_finance_alert.rb:4

请问这个是怎么回事,我直接用methods的把所有的方法打印出来,也的确没有看见alert_customer_balance的方法,请问是哪里初始化有问题那?
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值