Forum: Ruby on Rails form_tag error: only get requests allowed

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
6c3acc025a63460a367b7981e606e032?d=identicon&s=25 Neubyr Neubyr (neubyr)
on 2009-03-09 16:48
I am getting above error while updating an item using form_tag helper.

<h1>Edit Topic Item</h1>

<% 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 %>
<br />
<br />

Any clues?
81b61875e41eaa58887543635d556fca?d=identicon&s=25 Frederick Cheung (Guest)
on 2009-03-09 17:52
(Received via mailing list)
On 9 Mar 2009, at 15:48, Carlos Santana wrote:

> <% end %>
>
> <%= link_to 'Add Sub-Item to this Element', :action
> => :add_subitem, :id
> => @item %>
> <br />
> <br />
>

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
6c3acc025a63460a367b7981e606e032?d=identicon&s=25 Neubyr Neubyr (neubyr)
on 2009-03-09 18:10
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 Cheung wrote:
> On 9 Mar 2009, at 15:48, Carlos Santana wrote:
>
>> <% end %>
>>
>> <%= link_to 'Add Sub-Item to this Element', :action
>> => :add_subitem, :id
>> => @item %>
>> <br />
>> <br />
>>
>
> 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
This topic is locked and can not be replied to.