I was not able to find anything here or elsewhere that encompassed both restricting resource routes and adding additional non-RESTful routes in Rails 3. This is probably very simple, but every example or explanation I came across concerns only one case, not both at the same time.
Here is an example of what I did in Rails 2:
map.resources :sessions, :only => [:new, :create, :destroy], :member => {:recovery => :get}
Pretty simple, we only need 3 of 7 RESTful routes, because others do not make any sense for this resource, but we also want to add another route that is used to restore the account.
Now from what I'm going to do, one of these things is very simple:
resources :sessions, :only => [:new, :create, :destroy]
Like Rails 2. And:
resources :sessions do member do get :recovery end end
So how do I combine these two? Can I use the old Rails 2 method? Is there a preferred way to do this in Rails 3?
ruby ruby-on-rails routes
seaneshbaugh
source share