I'm upgrading rais 2.3.2 project to rails 3
Error:
undefined method `deliver_sent' for MailerFormError:Class
Application Trace | Framework Trace | Full Trace
app/controllers/leads_controller.rb:72:in `block in create'
app/controllers/leads_controller.rb:56:in `create'
MailerFormError is my model:
class MailerFormError < ActionMailer::Base
It's no method 'deliver_sent' in model and Actionmailer::Base too :(
code with it in controller:
@msg = {}
@msg["errors"] = @lead.errors
@msg["params"] = params
MailerFormError.deliver_sent(@msg)
Actionmailer version: actionmailer (3.2.11)
How can I solve this problem?
1) for Rails 3, to send your notification in your controller , I write this :
MailerFormError.sent(@msg).deliver
2) And I rewrite your 'sent' method in the Rails 3 way :
def sent(msg, sent_at = Time.now)
...
mail(:to => '...', :from => '...', :subject => '...') do |format|
format.html
format.text
end
...
end
Finally I create the text version and html in your view directory app/views/mail_form_error : sent.text.erb and sent.html.erb