map.resource, parameter restrictions

Posted by Tiago on Stack Overflow See other posts from Stack Overflow or by Tiago
Published on 2010-03-08T17:47:01Z Indexed on 2010/03/08 17:51 UTC
Read the original article Hit count: 260

Filed under:
|

I've a controller :platform here.

I'm trying to do something like:

/:platform_name/ to redirect to its show, with the parameter. Here is what I've got:

map.resource :platform,
               :as => ':platform_name',
               :platform_name => /pc|ps2|ps3|wii|ds|psp|xbox-360/

It's working fine. I've other neasted resources to it, and all them are accessing. But. The problem is, I've only those platform names, but when it doesnt fine another route, it aways fall on this. if I try /whatever/, it will look for the *platform_name => whatever*.

I was expecting it to fall into the map.connect ':controller/:action/:id' rule.

When I did *:platform_name => /pc|ps2|ps3|wii|ds|psp|xbox-360/*, wasnt expected that this rule only apply when the regular expression is fit?

how could i restrict this?

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about routes