开发者

rails routing question - restful url pointing to different controller

开发者 https://www.devze.com 2023-04-07 02:56 出处:网络
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 pa开发者_C百科ge_id param, rather than the Pages controller with the book_

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 pa开发者_C百科ge_id param, rather than the Pages controller with the book_id param. Is this possible?


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

0

精彩评论

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