ruby on rails 3 - Reusing form_for in view for a mailer errors on forgery -
I have a template in a new.html.erb form, where I usually save DB and then e- Mail on success I want to send mailer to the same new.html.erb as body and pass the model so that the form is fully populated. I am getting the following error:
Undefined method `protect_against_forgery? '# & Lt; # & Lt; For Class: 0x000000049d7110 & gt;: 0x000000049d4690 & gt;
On the line immediately after the form_ tag (I think it is auth token tag injection). Is there any way I can defect it so that I can use the template again in the mailer?
This looks like mailer code
class MaintenanceMailer & lt; ActionMailer :: Base Assistant: app def request_mail (maintenance) mail: from = & gt; Maintenance.community.email,: subject = & gt; "Maintenance" | Format | Format.html {Render: Layout = & gt; 'Default' ,: Template = & gt; 'Maintenance / New'} End End
Add it to a helper, which only Uses your mailer template:
def protect_against_forgery? False End
But make sure the recipient controller leaves the verified_assactivity_token, and for that session the jacquard is fine, whatever it is.
Comments
Post a Comment