简体   繁体   中英

rails routing question - restful url pointing to different controller

I have a Rails 3 app with a url like this: /books/1/pages/2

I want this to actually point to the Books controller but with a page_id param, rather than the Pages controller with the book_id param. Is this possible?

在routes.rb中: match '/books/:id/pages/:page_id' => 'books#your_action'

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