Catching a list of variables with a Controller
Boris Terzic
aggregat4+camping at gmail.com
Tue Nov 14 15:42:28 EST 2006
Hi All,
I have been learning some ruby and some Camping at the same time by
implementing a little webapp to track expenses (one man's blog...) that
includes the ability to tag entries with 1 or more tags.
I wanted to offer the possibility to narrow the view of expenses by adding
tags to a filter (this works) and I also wanted this filter to be reflected
in the URL. Like so:
normal URL: http://localhost:3301/
filtered URL: http://localhost:3301/filter/tag1/tag2/tag3
However, I can't get this to work since I require a variable number of
regexp groups (like say an array) and I could not find a routing syntax that
would allow this (something like class Filter < R '/filter/(\w/)*' ).
I currently use a route which looks like:
class Filter < R '/filter', '/filter/(.+)'
And I represent the N tags as a string where tags are comma-separated. It
works but purty, it isn't.
Suggestions? Or am I bonkers?
Thanks.
--
Boris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/camping-list/attachments/20061114/2046eba9/attachment.html
More information about the Camping-list
mailing list