Escaping URL on routes.rb

Hi, this is my first time posting anything here, and I’d like to make
you aware that I’m quite a newbie myself, so if this is a dull
question, I’d like to offer my excuses.

I’m working on this restful project of mine, and at some point I’ll be
sending emails to user with an URL, so they can get to the website by
clicking on it.

This URL is dynamic, and will have the following mapping on routes.tb:

‘:order_no/:email’

So on my local environment Id get something like:

http://127.0.0.1:3000/123456/[email protected]

Accessing this URL gives me the error:

No route matches

If I try the same URL without the .com bit of it i.e:

http://127.0.0.1:3000/123456/[email protected]

It works fine. I’m thinking it behaves this way because the .com is
not being properly escaped.

I tried adding something like URI.escape(’:order_no/:email’), but
still that didn’t do the trick.

Has anyone of you guys experienced this, and could you please tell me
how to get around it?

Thanks a lot in advance,

Marcos Placona

The dot is a separator. There’s a workaround though, add

:requirements => {:email => /.*/}

to the route definition.

Works a treat Xavier. Thanks a lot!

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs