Reputation: 3985
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?
Upvotes: 3
Views: 1704
Reputation: 18784
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.
User.first.send(:name)
is the same thing as calling
User.first.name
Just rename your method.
Upvotes: 3