Form_tag error: only get requests allowed


#1

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?


#2

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


#3

Thanks Fred once again
A big blunder over there… :frowning:

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