# \[Form\] Method POST & PUT problem

**URL:** <https://www.ruby-forum.com/t/form-method-post-put-problem/193399>\
**Category:** Rails\
**Created:** [August 17, 2010, 5:19am UTC](https://www.ruby-forum.com/t/form-method-post-put-problem/193399 "2010-08-17T05:19:48Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![davidstokar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/4da419/32.png) [@davidstokar](https://www.ruby-forum.com/u/davidstokar)\
**Post date:** [August 17, 2010, 5:19am UTC](https://www.ruby-forum.com/t/form-method-post-put-problem/193399/1 "2010-08-17T05:19:48Z")

</div>

Hello,

I have a form that should be a POST method, but Rails insist to put a  
hidden field “\_method” that has the value “put” does anyone knows why?

Thanks,

David S.

## Controller: ------------------------------- def new @user = @current\_user end

View: -------------------------------------  
\<% semantic\_form\_for @user, :url =\> profile\_reset\_password\_url do |form|  
-%\>  
\<% form.inputs -%\>  
\<%= form.input :password -%\>  
\<%= form.input :new\_password -%\>  
\<%= form.input :new\_password\_confirmation -%\>  
\<% end -%\>  
\<%= form.buttons %\>

## \<% end -%\>

## Routes: ----------------------------------- map.namespace :profile do |profile| profile.resource :reset\_password, :only =\> [:new, :create] end

Output: -----------------------------------

InformaÃ§Ãµes
1. Password\*
 New password\* New password confirmation\*

1. 

##

---

<div class="post-metadata">

**Author:** ![davidstokar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/4da419/32.png) [@davidstokar](https://www.ruby-forum.com/u/davidstokar)\
**Post date:** [August 17, 2010, 9:11am UTC](https://www.ruby-forum.com/t/form-method-post-put-problem/193399/2 "2010-08-17T09:11:48Z")

</div>

On 17 Aug 2010, at 05:19, David S. wrote:

> I have a form that should be a POST method, but Rails insist to put a  
> hidden field “\_method” that has the value “put” does anyone knows why?

Since @user already exists in the database (you assign an existing  
record @current\_user to it) and is not a new\_record?, Rails assumes  
you want to update the record aka a PUT request. Probably just  
adding :method =\> :post as a parameter will do the trick.

---

<div class="post-metadata">

**Author:** ![davidstokar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/4da419/32.png) [@davidstokar](https://www.ruby-forum.com/u/davidstokar)\
**Post date:** [August 17, 2010, 2:14pm UTC](https://www.ruby-forum.com/t/form-method-post-put-problem/193399/3 "2010-08-17T14:14:56Z")

</div>

Thanks Peter, just adding :method =\> :post worked.

Let me ask one more thing, just after a submit the form, the firefox  
open a dialog box asking me each of users that is in a list that I want  
to change the password. Actually does not matter each you pick, the user  
that you are logon on the site gets the pass changed.

Tks again.

David S.
