[1.2.1]
I''ve added a custom resource route, but routing fails. (AWDWR was
consulted)
map.resources :project, :member => { :change_state => :put }
in routes.rb
successfully creates a nice url helper [change_state_project_url(82)]
which results in: "/projects/82;change_state"
and a error message:
ActionController::RoutingError (no route found to match "/projects/
82;change_state" with {:method=>:post}):
.//vendor/rails/actionpack/lib/action_controller/routing.rb:
1264:in `recognize_path''
.//vendor/rails/actionpack/lib/action_controller/routing.rb:
1254:in `recognize''
In the projects controller I have an action as such (trimmed):
def change_state
end
which responds to a non-restful route request [/projects/change_state]:
(btw, I have tested :post and :get. same result)
does this ring any bells? I''m looking for inspiration.
bueller? bueller?
thanx.
Jodi
General Partner
The nNovation Group inc.
www.nnovation.ca/blog
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---
Michael D. Ivey
2007-Jan-29 21:31 UTC
Re: custom rails resource action fails to restfully route
On Jan 29, 2007, at 3:18 PM, Jodi Showers wrote:> map.resources :project, :member => { :change_state => :put } > > ActionController::RoutingError (no route found to match "/projects/ > 82;change_state" with {:method=>:post}):You defined a route as a :put, but are calling it as a :post. Try: change_state_project_url(82,:method=>:put) or change your route to map.resources :project, :member => { :change_state => :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 -~----------~----~----~----~------~----~------~--~---
On Jan 29, 4:31 pm, "Michael D. Ivey" <michael.i...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Jan 29, 2007, at 3:18 PM, Jodi Showers wrote: > > > map.resources :project, :member => { :change_state => :put } > > > ActionController::RoutingError (no route found to match "/projects/ > > 82;change_state" with {:method=>:post}):You defined a route as a :put, but are calling it as a :post. Try: > change_state_project_url(82,:method=>:put) > or change your route to > map.resources :project, :member => { :change_state => :post }doh! thanx Michael. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---