Adam Watson
unread,Nov 15, 2011, 9:33:04 PM11/15/11Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Goliath.io
I'm having problems getting multiple routes with differently formatted
variable segments to work... is it possible to provide multiple
similar routes with different regex constraints for the variable
segment?
In other words, the following route assignments do not work since only
the first route seems to be registered:
class RackRoutes < Goliath::API
get '/items/:item_type/count', :item_type => /^[a-zA-Z][\w\-]+$/
do
... do some awesome stuff with an alpha-based param...
end
get '/items/:item_id/count', :item_id => /\d+/ do
...do some stuff with a numeric param....
end
end
In the above code, if I try to hit the second route using a numeric
parameter segment, I always get a 404.
I know I could perform the regex inside the body of the mapping, but I
really want a 404 to be issued if neither of the regex patterns are
matched using the map provided.
Thanks!
Adam