# Form\_tag error: only get requests allowed

**URL:** <https://www.ruby-forum.com/t/form-tag-error-only-get-requests-allowed/162402>\
**Category:** Rails\
**Created:** [March 9, 2009, 4:48pm UTC](https://www.ruby-forum.com/t/form-tag-error-only-get-requests-allowed/162402 "2009-03-09T16:48:35Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![neubyr](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/c37758/32.png) [@neubyr](https://www.ruby-forum.com/u/neubyr)\
**Post date:** [March 9, 2009, 4:48pm UTC](https://www.ruby-forum.com/t/form-tag-error-only-get-requests-allowed/162402/1 "2009-03-09T16:48:35Z")

</div>

I am getting above error while updating an item using form\_tag helper.

# Edit Topic Item

\<% form\_tag edit\_topic\_item\_path(@item.topic, @item), :html =\> { :method  
=\> :put} do %\>  
\<%= render :partial =\> ‘item\_form’, :object =\> @item %\>  
\<%= submit\_tag ‘Save’ %\>  
\<% end %\>

\<%= link\_to ‘Add Sub-Item to this Element’, :action =\> :add\_subitem, :id  
=\> @item %\>

Any clues?

---

<div class="post-metadata">

**Author:** ![neubyr](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/c37758/32.png) [@neubyr](https://www.ruby-forum.com/u/neubyr)\
**Post date:** [March 9, 2009, 5:52pm UTC](https://www.ruby-forum.com/t/form-tag-error-only-get-requests-allowed/162402/2 "2009-03-09T17:52:51Z")

</div>

On 9 Mar 2009, at 15:48, Carlos S. wrote:

> \<% end %\>
> 
> \<%= link\_to ‘Add Sub-Item to this Element’, :action  
> =\> :add\_subitem, :id  
> =\> @item %\>

edit\_topic\_item\_path returns the path to the edit page, which isn’t  
where you want to send your updates to

If I were you I’d just use form\_for which hangles all that sort of  
stuff for you.

Fred

---

<div class="post-metadata">

**Author:** ![neubyr](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/c37758/32.png) [@neubyr](https://www.ruby-forum.com/u/neubyr)\
**Post date:** [March 9, 2009, 6:10pm UTC](https://www.ruby-forum.com/t/form-tag-error-only-get-requests-allowed/162402/3 "2009-03-09T18:10:39Z")

</div>

Thanks Fred once again  
A big blunder over there… ☹

I am cleaning up someone else’s code and I am new to to rails. And  
majority of the developers seem to be using form\_for and not form\_tag. I  
found it useful as it directly handles ActiveRecord objects… So for my  
new code I am using the same.

Frederick C. wrote:

> On 9 Mar 2009, at 15:48, Carlos S. wrote:
> 
> > \<% end %\>
> > 
> > \<%= link\_to ‘Add Sub-Item to this Element’, :action  
> > =\> :add\_subitem, :id  
> > =\> @item %\>
> 
> edit\_topic\_item\_path returns the path to the edit page, which isn’t  
> where you want to send your updates to
> 
> If I were you I’d just use form\_for which hangles all that sort of  
> stuff for you.
> 
> Fred
