Jack
Jack

Reputation: 51

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?

Upvotes: 0

Views: 56

Answers (1)

Adam Eberlin
Adam Eberlin

Reputation: 14205

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

Upvotes: 2

Related Questions