I have one model: new and its controller: news
The news controller methods:
def edit
@new = New.find(params[:id].to_i)
end
def update
@new = New.find(params[:id].to_i)
@new.update_attributes(params[:new])
flash[:notice] = "Sikeresen frissítve"
redirect_to news_path
rescue ActiveRecord::RecordInvalid
flash[:error] = "Valami hiba lépett fel"
redirect_to edit_news_path(@new)
end
And here is the edit.html.erb
<%= error_messages_for :news %>
<% form_for :new, :url=>news_path(@new), :html=>{:method=>:put} do |m|%>
<p> <%= m.label(:title,"title: ") %>
<%= m.text_field(:title) %></p>
<p>
<%= m.label(:text, "text: ") %>
<%= m.text_area(:text) %>
</p>
<%= submit_tag "Save" %>
<% end %>
It's works fine, no error, the field showed up in the textboxes, but if I click the submit button I gave unknown action error