# Link\_to problem with '.' in :id parameter (must be escaped!)

**URL:** <https://www.ruby-forum.com/t/link-to-problem-with-in-id-parameter-must-be-escaped/140372>\
**Category:** Rails\
**Created:** [June 13, 2008, 11:33am UTC](https://www.ruby-forum.com/t/link-to-problem-with-in-id-parameter-must-be-escaped/140372 "2008-06-13T11:33:57Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![teddio](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/b3f665/32.png) [@teddio](https://www.ruby-forum.com/u/teddio)\
**Post date:** [June 13, 2008, 11:33am UTC](https://www.ruby-forum.com/t/link-to-problem-with-in-id-parameter-must-be-escaped/140372/1 "2008-06-13T11:33:57Z")

</div>

Hi,

I have this very normal link\_to call:

\<%= link\_to name, tag\_path(name) %\>

The ‘name’ can be something like “[ASP.NET](http://ASP.NET)”. That results in a URL like  
[http://localhost:3000/tag/ASP.NET](http://localhost:3000/tag/ASP.NET)

The Problem: I get a “no route” for this URL. I have a route  
map.tag ‘/tag/:id’, :controller =\> ‘items’, :action =\> ‘tag’

Everything would be fine IF I could just escape the dot to “%2E”, so  
that the URL is something like  
[http://localhost:3000/tag/ASP.NET](http://localhost:3000/tag/ASP%2ENET)

PROBLEM: link\_to doesnt’t do it, and when I do it myself the “%” is  
escaped, so that it looks like  
[http://localhost:3000/tag/ASP%252EENET](http://localhost:3000/tag/ASP%252EENET)

Any advice?

TIA,  
Michael

---

<div class="post-metadata">

**Author:** ![teddio](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/b3f665/32.png) [@teddio](https://www.ruby-forum.com/u/teddio)\
**Post date:** [June 13, 2008, 4:32pm UTC](https://www.ruby-forum.com/t/link-to-problem-with-in-id-parameter-must-be-escaped/140372/2 "2008-06-13T16:32:08Z")

</div>

Well, I solved it with this line:

\<%= link\_to name, ‘/tag/’+name.gsub(’.’,’%2E’), :class =\> css\_class %\>
