【发布时间】:2014-01-25 23:48:47
【问题描述】:
我有一个运行良好的 Rails 3 邮件程序。
class Notifier < ActionMailer::Base
def cool_email(user_id)
@user = User.find_by_id(user_id)
mail(to: @user.email,
from: 'admin@example.com',
subject: 'hi'
)
end
end
此视图将正确呈现@user 实例变量,并且电子邮件发送没有任何问题。
但是,当我为邮件程序命名时,一切都会中断。使用这样的邮件结构。
class Foo::Notifier < ::ActionMailer::Base
def cool_email(user_id)
@user = User.find_by_id(user_id)
mail(to: @user.email,
from: 'admin@example.com',
subject: 'hi'
)
end
end
而且app/view/foo里面的view,Rails是找不到html模板的。电子邮件发送,但正文中没有任何内容。
我做错了什么?
【问题讨论】:
标签: ruby-on-rails actionmailer