REST route with multiple ids

How can I configure a REST route to accept multiple ids?

for instance, in Highrise by 37signals tags have either routes like tags/47824 or tags/47824,43622,43628

I suppose it's done with some regexp expertize, but I have none, and I wouldn't know where to put it. A hand would be appreciated.

In the instance of those comma-separated multiple tags, params[:id] is "47824,43622,43628" and it's just being split or handled in the method. I don't think :id gets coerced to an integer because that could spoil implementations of routing which use to_param differently. [I could totally be off on that.] But I'm pretty sure that "47824,43622,43628" is just a string getting split on the commas something like

Tag.find params[:id].split(",")

I'd love to find out if I'm wrong and what the real implementation is. I'm kinda curious now.

RSL

Russell, you are right. I just tried this using a Page model. You could also send up a list of the tag names instead of the id's, making it a little more semantic (see Jonathan Linowes on http://www.vaporbase.com/postings/A_Micro-CMS_in_Rails).

but how do I set a route for that? Right now I get this error:

no route found to match "/tags/19,16" with {:method=>:get}

I'm on rails 1.2.4. Are you on 2.0, or am I missing something else?

Add this to your environment.rb ActionController::Routing::SEPARATORS = %w(/ ; . ?)

OK, that works, thanks Pablo.

So if I by adding this line I'm actually removing ',' from the SEPARATORS array... You've introduced me to SEPARATORS, and made me understand I could use any characters except the ones in that array. So instead of adding that line and using ',' II decided to simply use '+', à la del.icio.us. There's no drawbacks in using '+' is there? For example:

tags/645+456+456

It works, but "+" is a space URL encoded (RFC1738). That's mean in your controller you should split by spaces instead of '+'.