Forum: Ruby on Rails Restful route not found

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
82a578052d304559f15180bdf56555d2?d=identicon&s=25 Tarscher (Guest)
on 2007-06-24 15:19
(Received via mailing list)
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}):
A887cc76c61e1f4148caacb5f32361d6?d=identicon&s=25 jparker (Guest)
on 2007-06-26 00:02
(Received via mailing list)
>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 topic is locked and can not be replied to.