Rails-Fundstück: Catch-All in Routes

Wusste gar nicht, dass routes.rb auch sowas erlaubt:

map.connect 'whatever/*blah‘, :controller => … #usw.

params[:blah] ist dann ein Array, das die Pfadkomponenten enthält, die dem statischen Teil der Route folgten. Also bei der URI /whatever/eins/zwei/drei dann ['eins', 'zwei', 'drei']. Nett!

Posted in Verschiedenstes

One Comment

  1. Nice! Mhmm… mal sehen, wo ich das einbaue.

Leave a Reply

Using Gravatars in the comments - get your own and be recognized!

XHTML: These are some of the tags you can use: <a href=""> <b> <blockquote> <code> <em> <i> <strike> <strong>