logo       

Catching a list of variables with a Controller: msg#00015

lang.ruby.camping.general

Subject: Catching a list of variables with a Controller

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
_______________________________________________
Camping-list mailing list
Camping-list-GrnCvJ7WPxnNLxjTenLetw@xxxxxxxxxxxxxxxx
http://rubyforge.org/mailman/listinfo/camping-list
<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise