I am trying to use single method for Edit and Update..but doesn''t seem
to work.
Following is in my view...
<% form_for :project, @project, :html => {:method => :put}, :url =>
{:action => ''edit''} do |f| %>
Name: <br/> <%= f.text_field :name %> <br/>
Description: <br/><%= f.text_area :description, :rows => 5 %>
<br/>
<%= f.submit "Submit" -%> <%= link_to
''Cancel'', projects_path -%>
<% end -%>
and following is in my controller...
def edit
@project = Project.find(params[:id])
if request.put?
respond_to do |format|
if @project.update_attributes(params[:project])
flash[:notice] = "Project updated successfully."
format.html {redirect_to(projects_path)}
format.xml {head :ok}
end
end
end
end
but when I press Submit, it says ''nothing responded to 1 (id of
project).''
What could be wrong?
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---