开发者

Mapping a subroute/subaction to a controller action in Rails 3

开发者 https://www.devze.com 2023-03-01 23:11 出处:网络
Lets say we have a GoodTimes controller and we want to create the following mappings between routes and controller actions (in addition to the standard resources):

Lets say we have a GoodTimes controller and we want to create the following mappings between routes and controller actions (in addition to the 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 land we could do:

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

Our path-helpers would then be:

party_new_good_time_path
afterparty_new_good_time_path
eurorave_new_good_time_path

What is the preferred method of accomplishing the same in Rails 3 land?

This question is answered here: Adding custom :new routes using Rails 3 rou开发者_开发知识库ting

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号