Custom rails resource action fails to restfully route

[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:inrecognize’

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

On Jan 29, 2007, at 3:18 PM, Jodi S. 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 }

On Jan 29, 4:31 pm, “Michael D. Ivey” [email protected] wrote:

On Jan 29, 2007, at 3:18 PM, Jodi S. 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.