Restful route not found

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’

Console output:
Processing ApplicationController#index (for 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}):

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.)


This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs