Subroutine / sub-action mapping for controller action in Rails 3

Suppose we have a GoodTimes controller , and we want to create the following mappings between routes and controller actions (in addition to standard resources):

/good_times/new/party          {:controller => "good_times", :action => "party"}
/good_times/new/afterparty     {:controller => "good_times", :action => "afterparty"}
/good_times/new/eurorave       {:controller => "good_times", :action => "eurorave"}

In Rails 2 ground, we could do:

map.resources :good_times, :new => {:party => :get, :afterparty => :get, :eurorave => :post}

Our helpers along the way will:

party_new_good_time_path
afterparty_new_good_time_path
eurorave_new_good_time_path

What is the preferred method to achieve this in the land of Rails 3?

This question has been answered: Adding custom: new routes using Rails 3 routing

+3
source share