テンプレート new.html.erb に form_for があり、DB に通常の保存を行い、成功時に電子メールを送信します。フォームが完全に入力されるように、メーラーが本文と同じ new.html.erb を送信し、モデルを渡すようにします。次のエラーが表示されます。
undefined method `protect_against_forgery?' for #<#<Class:0x000000049d7110>:0x000000049d4690>
form_for タグの直後の行 (認証トークン タグを挿入しているため)。メーラーでテンプレートを再利用できるように、これを回避する方法はありますか?
メーラーコードは次のようになります
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