custom rails resource action fails to restfully route


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


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?


General Partner

The nNovation Group inc.

ranting o the technology and business of software

You defined a route as a :put, but are calling it as a :post. Try:
or change your route to
map.resources :project, :member => { :change_state => :post }


thanx Michael.