I have form_for in the new.html.erb template, where I do the usual save to the database, and then email when it succeeds. I want the mailer to send the same new.html.erb as the body and submit the model so that the form is completely filled. I get the following error:
undefined method `protect_against_forgery?' for #<#<Class:0x000000049d7110>:0x000000049d4690>
In the line immediately after the form_for tag (since I think it inserts the auth token token). Is there any way around this so that I can reuse the template in my inbox?
This is what the mailer code looks like
class MaintenanceMailer < ActionMailer::Base
helper :application
def request_email(maintenance)
mail :to => maintenance.community.email, :subject => "Maintenance" do |format|
format.html { render :layout => 'default', :template => 'maintenance/new' }
end
end
end
source
share