I am trying to create a mail to users which includes a simple html form. For this I am using A开发者_如何学PythonctionMailer from Rails 3 as suggested in the tutorial at http://edgeguides.rubyonrails.org/action_mailer_basics.html#example-action-mailer-configuration
I am not able to use ActionView helpers like form_tag in the mailer erb file. How do I get access to them in the erb file.
My user.html.erb file has code like this:
<%= form_tag(:controller => "application", :action => "parent_select", :method=>"put") do %>
Want To Attend
<%= check_box_tag(:yes, '1', request.priority != 0) %>
<% end %>
I get this error:
undefined method `protect_against_forgery?' for #<#<Class:0xa0874c4>:0xa085a70>
It's not a good idea to put your form in an email see:
http://www.campaignmonitor.com/blog/post/2435/how-forms-perform-in-html-emai/
But what you are seeing here is the form is being sent without the csrf_meta_tag (form token and auth). You can either turn forgery protection off for this action or add in these fields manually to your form.
精彩评论