Created
October 24, 2008 16:55
-
-
Save paul/19488 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Merb::Router.prepare do | |
# match('/templates/:template_id', :template_id => /.+/) do | |
# match('/questions/:name').to(:controller => 'questions', :action => 'show').name(:question) | |
# match('/questions').to(:controller => 'questions', :action => 'index').name(:questions) | |
# end | |
# match('/templates').to(:controller => 'templates', :action => 'index').name(:templates) | |
# match('/templates/:id', :id => /.+/).to(:controller => 'templates', :action => 'show').name(:template) | |
resources :templates, :id => /.+(?=(/questions)?/ do | |
resources :questions, :keys => :name, :name => /.+/ | |
end | |
end | |
# I need to match paths like: | |
# | |
# /templates/foo/bar {:controller => 'templates', :id => 'foo/bar'} | |
# /templates/foo/bar/questions {:controller => 'questions', :template_id => 'foo/bar'} | |
# The commented-out routes match ok, but the #resources for does not, | |
# using both :id => /.+/ and the lookahead I have in there now. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment