I’m working with restful_authentication plugin and note that it adds
the following to routes.rb:
map.resource :session
This assumes I named my controller in the singular, which I did. The
above resource creates the following routes copied from “rake routes”
output):
POST /session
{:controller=>“sessions”, :action=>“create”}
POST /session.:format
{:controller=>“sessions”, :action=>“create”}
new_session GET /session/new
{:controller=>“sessions”, :action=>“new”}
formatted_new_session GET /session/new.:format
{:controller=>“sessions”, :action=>“new”}
edit_session GET /session/edit
{:controller=>“sessions”, :action=>“edit”}
formatted_edit_session GET /session/edit.:format
{:controller=>“sessions”, :action=>“edit”}
session GET /session
{:controller=>“sessions”, :action=>“show”}
formatted_session GET /session.:format
{:controller=>“sessions”, :action=>“show”}
PUT /session
{:controller=>“sessions”, :action=>“update”}
PUT /session.:format
{:controller=>“sessions”, :action=>“update”}
DELETE /session
{:controller=>“sessions”, :action=>“destroy”}
DELETE /session.:format
{:controller=>“sessions”, :action=>“destroy”}
Lovely…thats three actions too many. I don’t want half these.
Specifically, these:
edit_session GET /session/edit
{:controller=>“sessions”, :action=>“edit”}
formatted_edit_session GET /session/edit.:format
{:controller=>“sessions”, :action=>“edit”}
session GET /session
{:controller=>“sessions”, :action=>“show”}
formatted_session GET /session.:format
{:controller=>“sessions”, :action=>“show”}
PUT /session
{:controller=>“sessions”, :action=>“update”}
PUT /session.:format
{:controller=>“sessions”, :action=>“update”}
should not exist. This is my SessionController. Pretty important
stuff. Of course, my controller won’t have code to handle the above
actions and I won’t have views for them. But I also don’t want routes
for them either.
What’s the best way to exclude some and still have fully qualified
RESTful routes for the routes I do want??
thanks, Jon
www.shellshadow.com