Rails 邮件程序“未定义方法”错误。
我正在尝试在 Rails 3.1 中设置一个简单的邮件程序。
我的邮件程序中有以下代码...
class Notify < ActionMailer::Base
default :from => "[email protected]"
def send
@email = email
@ip = ip
mail(:to => "[email protected]", :subject => "#{email} just signed up")
end
end
然后在我的控制器中...
Notify.send(params[:email], ip).deliver
由于某种原因,当在我的控制器中调用该行时我无法计算出以下错误...
undefined method `*string I passed in*' for Notify:Class
我有什么想法这里做错了吗?
I'm trying to setup a simple mailer in rails 3.1.
I have the following code in my mailer...
class Notify < ActionMailer::Base
default :from => "[email protected]"
def send
@email = email
@ip = ip
mail(:to => "[email protected]", :subject => "#{email} just signed up")
end
end
Then in my controller I have...
Notify.send(params[:email], ip).deliver
For some reason that I can't work out when that line is called in my controller I get the following error...
undefined method `*string I passed in*' for Notify:Class
Any ideas what I'm doing wrong here?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
send() 已由 Ruby 定义,用于传递消息。
因此,对于 ruby 来说,您似乎正在尝试调用一个方法。
与调用相同,
只需重命名您的方法。
send() is already defined by Ruby, and it is used to pass messages around.
So, to ruby it looks like you are trying to call a method.
is the same thing as calling
Just rename your method.