Skip to content

Instantly share code, notes, and snippets.

@ryanb
Created August 12, 2008 14:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ryanb/5046 to your computer and use it in GitHub Desktop.
Save ryanb/5046 to your computer and use it in GitHub Desktop.
# single controller
map.with_options :controller => 'info' do |info|
info.about 'info/about', :action => 'about'
info.privacy 'legal/privacy', :action => 'privacy'
info.license 'legal/license', :action => 'license'
end
# multiple controllers
map.about 'info/about', :controller => 'info', :action => 'about'
map.privacy 'legal/privacy', :controller => 'legal', :action => 'privacy'
map.license 'legal/license', :controller => 'legal', :action => 'license'
# pages controller with nesting (parse params[:pages] array in show action)
# the page model could use acts_as_tree for nesting.
map.resources :pages
map.nested_page '*pages', :controller => 'pages', :action => 'show'
# I think the "one controller" approach is the safest if you aren't sure.
# You can refactor into the others as needed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment