Given a line something like below in routes.rb
map.resources :users
The routes generated might be something like this:
users GET /users(.:format) {:controller=>"users", :action=>"index"}
POST /users(.:format) {:controller=>"users", :action=>"create"}
new_user GET /users/new(.:format) {:controller=>"users", :action=>"new"}
edit_user GET /users/:id/edit(.:format) {:controller=>"users", :action=>"edit"}
user GET /users/:id(.:format) {:controller=>"users", :action=>"show"}
PUT /users/:id(.:format) {:controller=>"users", :action=>"update"}
DELETE /users/:id(.:format) {:controller=>"users", :action=>"destroy"}
Is there any way to change the default HTTP method of POST /users
mapping to {:controller=>"users", :action=>"create"}
to the HTTP method being used to be a PUT
instead?
rake routes
would then generate something like this:
users GET /users(.:format) {:controller=>"users", :action=>"index"}
PUT /users(.:format) {:controller=>"users", :action=>"create"}
new_user GET /users/new(.:format) {:controller=>"users", :action=>"new"}
edit_user GET /users/:id/edit(.:format) {:controller=>"users", :action=>"edit"}
user GET /users/:id(.:format) {:controller=>"users", :action=>"show"}
PUT /users/:id(.:format) {:controller=>"users", :action=>"update"}
DELETE /users/:id(.:format) {:controller=>"users", :action=>"destroy"}
I understand that this wouldn't be correct for RESTful routing, I'm just wondering if it is possible to change the HTTP methods used by these routes.