# Escaping URL on routes.rb

**URL:** <https://www.ruby-forum.com/t/escaping-url-on-routes-rb/183762>\
**Category:** Rails\
**Created:** [February 19, 2010, 5:17pm UTC](https://www.ruby-forum.com/t/escaping-url-on-routes-rb/183762 "2010-02-19T17:17:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Marcos\_Placona](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/c2a13f/32.png) [@Marcos\_Placona](https://www.ruby-forum.com/u/Marcos_Placona)\
**Post date:** [February 19, 2010, 5:17pm UTC](https://www.ruby-forum.com/t/escaping-url-on-routes-rb/183762/1 "2010-02-19T17:17:37Z")

</div>

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/removed\_email\_address@domain.invalid](http://127.0.0.1:3000/123456/removed_email_address@domain.invalid)

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/user@user](http://127.0.0.1:3000/123456/user@user)

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

---

<div class="post-metadata">

**Author:** ![Marcos\_Placona](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/c2a13f/32.png) [@Marcos\_Placona](https://www.ruby-forum.com/u/Marcos_Placona)\
**Post date:** [February 19, 2010, 7:11pm UTC](https://www.ruby-forum.com/t/escaping-url-on-routes-rb/183762/2 "2010-02-19T19:11:14Z")

</div>

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

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

```

to the route definition.

---

<div class="post-metadata">

**Author:** ![Marcos\_Placona](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/c2a13f/32.png) [@Marcos\_Placona](https://www.ruby-forum.com/u/Marcos_Placona)\
**Post date:** [February 20, 2010, 12:27am UTC](https://www.ruby-forum.com/t/escaping-url-on-routes-rb/183762/3 "2010-02-20T00:27:20Z")

</div>

Works a treat Xavier. Thanks a lot!
