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?
Sending e-mails changed a lot between 2.3 and 3.2. Here is a basic howto: http://xyzpub.com/en/ruby-on-rails/3.2/action_mailer.html
1) for Rails 3, to send your notification in your controller , I write this :
2) And I rewrite your 'sent' method in the Rails 3 way :
Finally I create the text version and html in your view directory app/views/mail_form_error : sent.text.erb and sent.html.erb