# Restful route not found

**URL:** <https://www.ruby-forum.com/t/restful-route-not-found/107634>\
**Category:** Rails\
**Created:** [June 24, 2007, 3:19pm UTC](https://www.ruby-forum.com/t/restful-route-not-found/107634 "2007-06-24T15:19:58Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tarscher](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/8491ac/32.png) [@Tarscher](https://www.ruby-forum.com/u/Tarscher)\
**Post date:** [June 24, 2007, 3:19pm UTC](https://www.ruby-forum.com/t/restful-route-not-found/107634/1 "2007-06-24T15:19:58Z")

</div>

Hi all,

When I try to submit an edit of a node I get:  
Routing Error  
no route found to match “/nodes/2” with {:method=\>:post}

I don’t see why because “/nodes/2” is the restful way I think and I  
have map.resources :nodes in my routes

In routes I have  
map.resources :nodes

entre routes file:  
ActionController::Routing::Routes.draw do |map|  
map.resources :clubs, :users, :posts, :sessions, :nodes, :trees

map.index ‘’, :controller =\> ‘clubs’, :action =\> ‘show’  
map.home ‘’, :controller =\> ‘clubs’, :action =\> ‘show’  
map.tree ‘/tree’, :controller =\> ‘trees’, :action =\> ‘show’  
end

Console output:  
Processing ApplicationController#index (for 127.0.0.1 at 2007-06-24  
15:11:56) [POST]  
Session ID: 1fe39877cf4cf88dbed948ee3ab5ac9e  
Parameters: {“commit”=\>“Update”, “node”=\>{“name”=\>“Trainer”,  
“kind”=\>“tak”, “parent\_id”=\>“1”}}  
ActionController::RoutingError (no route found to match “/nodes/2”  
with {:method=\>:post}):

---

<div class="post-metadata">

**Author:** ![Tarscher](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/8491ac/32.png) [@Tarscher](https://www.ruby-forum.com/u/Tarscher)\
**Post date:** [June 26, 2007, 12:02am UTC](https://www.ruby-forum.com/t/restful-route-not-found/107634/2 "2007-06-26T00:02:53Z")

</div>

> From your console output it looks like you are trying to update an  
> existing node. You will want to make sure that your form action is  
> pointed at node\_path(@node) and that it is using the PUT method. (POST  
> is used when creating new resources, i.e., POST /nodes. PUT is used  
> when updating existing resources, i.e., PUT /nodes/2).

\<% form\_for(:node, :url =\> node\_path(@node), :html =\> { :method  
=\> :put }) do |…| %\>

(That :method =\> :put option will result in a hidden input field named  
“method” with a value of “put” which Rails will interpret to treat the  
request as if it came from an actual HTTP PUT request.)

-John
