简体   繁体   中英

How do I route :collection to use /controller/action/:id in rails 2.3 & 3?

If I have code that looks like this:

:collection => {
  :download_print_use => :get
}

rake routes dosn't show me how to use :id to map to something like /controller/download_print_use/:id

what do I need to do to make this work?

Because that's the point of the collection option. Ex: events/download_print .

I think you need to use :member => {} to get what you want.


It's the same principle in rails 3, but with a more elegant syntax. You can read this paragraph to understand it better: http://guides.rubyonrails.org/routing.html#adding-more-restful-actions

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM