# Edit method and request.put? check

**URL:** <https://www.ruby-forum.com/t/edit-method-and-request-put-check/133665>\
**Category:** Rails\
**Created:** [April 2, 2008, 12:38pm UTC](https://www.ruby-forum.com/t/edit-method-and-request-put-check/133665 "2008-04-02T12:38:11Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![vapor](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/5e9695/32.png) [@vapor](https://www.ruby-forum.com/u/vapor)\
**Post date:** [April 2, 2008, 12:38pm UTC](https://www.ruby-forum.com/t/edit-method-and-request-put-check/133665/1 "2008-04-02T12:38:11Z")

</div>

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:   
 \<%= f.text\_field :name %\>   
  
Description:   
\<%= f.text\_area :description, :rows =\> 5 %\>   
  
\<%= 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?

---

<div class="post-metadata">

**Author:** ![vapor](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/5e9695/32.png) [@vapor](https://www.ruby-forum.com/u/vapor)\
**Post date:** [April 12, 2008, 11:49pm UTC](https://www.ruby-forum.com/t/edit-method-and-request-put-check/133665/2 "2008-04-12T23:49:33Z")

</div>

> \<% form\_for :project, @project, :html =\> {:method =\> :put}, :url =\>  
> You want something like  
> \<% form\_for :project, project\_path(@project), …
