I have a form_for in a template new.html.erb where I do the normal save to the DB and then an e-mail on success. I want the mailer to send the same new.html.erb as the body and pass the model so that the form is fully populated. I'm getting the following error:
undefined method `protect_against_forgery?' for #<#<Class:0x000000049d7110>:0x000000049d4690>
On the line immediately after the form_for tag (since it's injecting the auth token tag I think). Is there a way I can circumvent this so that I can re-use the template in the mailer?
Here's 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