Custom urls and paths in rails
I have two models: Books and pages in a typical one_to_many relationship.How can I make the followingpage_path(@page)output this path:bookname/page/pageidinstead ofpage/pageidIf I override the...
View ArticleAnswer by Matt for Custom urls and paths in rails
Not sure if it's possible to get exactly what you want, but you can make the Page a nested resource under book like this:resources :books do resources :pagesendThen you will...
View ArticleAnswer by tw airball for Custom urls and paths in rails
I'm assuming you mean to have path as /:book_name/page/:idIn routes.rb:match '/:book_name/page/:id' => "page#show", :as => :pageIn the controller you would access params[:id] to get page.id and...
View ArticleAnswer by Zuhaib Ali for Custom urls and paths in rails
I discovered that to have full control over path helpers, you have to override those inside the application_helper.erb file. The following code worked for me:def pages_path(@page) @bookpath =...
View Article