I'm creating a Ruby on Rails app that consists of stories. Each story has multiple pages.
How can I set up routes.rb so that I can have URLs like this:
http://mysite.com/[story id]/[page id]
Like:
http://mysite.com/29/46
Currently I'm using this sort of setup:
http://mysite.com/stories/29/pages/46
Using:
ActionController::Routing::Routes.draw do |map|
map.resources :stories, :has_many => :pages
map.resources :pages
map.root :controller => "stories", :action => "index"
map.connect ':controller/:action/:id'
map.connect ':controller/:action/:id.:format'
end
Thanks in advance. I'm a newbie to Rails and routing seems a bit complicated to me right now.