I am experimenting with a combined form.  I wish to force the HTTP verb
for this form to PUT.  However, it always uses POST when submitted and I
cannot determine why.

The view template code is:

  <%=form_for( @user,
      :html => {
        :class => :edit_user_role,
        :id => :edit_user_role_form,
        :method => :put },
      :url => user_roles_url( @user )

        ) do |f|-%>

The resulting html is:

<form accept-charset="UTF-8"
  action="http://www.example.com/users/330/roles";
  class="edit_user_role"
  id="edit_user_role_form" method="post">
  <div style="margin:0;padding:0;display:inline">
    <input name="utf8" type="hidden" value="&#x2713;" />
    <input name="_method" type="hidden" value="put" />
  </div>

This confuses me.  The form method is not being set by the html
attribute but a hidden field is being created instead.  Since Rails
considers only the HTTP verb for routing this simply will not work as I
expect.

What is the problem with my approach?  How does one set the form method?

-- 
Posted via http://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to