from the wiki http://wiki.merbivore.com/howto/router
# the following matches /articles/* and captures * as a params[:title] in your controller. # note that the resource also matches the url: /articles/foo/bar/baz/... # the "infinitely" nested subpath foo/bar/baz/... will be captured as params[:title] resources :articles, :identify => :title, :title => /.*/ On Nov 24, 2008, at 19:09, bergstyle wrote: > > what's the equivalent of doing rails style url globbing with Merb's > router? > > Example: > If someone connects to > /files/list/base/books/fiction/dickens > > you want the files/list action to have access to all four remaining > fields. But sometimes there might be only three fields: > /files/list/base/books/fiction > > or five: > /files/list/base/books/fiction/dickens/little_dorrit > > So you need a route that will match (in this particular case) > everything after the second URI component. > > You can do that with a route glob. You "glob" the route with an > asterisk: > map.connect 'files/list/*specs' > > Now, the files/list action will have access to an array of URI fields, > accessible via params[:specs]: > def list > specs = params[:specs] # e.g, ["base", "books", "fiction", > "dickens"] > end > > http://tinyurl.com/6a26le > as explained: > > -- Jan - MooTools comitter twitter/blog: http://kassens.net --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "merb" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/merb?hl=en -~----------~----~----~----~------~----~------~--~---
