>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
On Jun 24, 6:19 am, Tarscher
<tarsc...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> 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}):
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---