Michael Hasenstein
2008-Jun-13 09:33 UTC
link_to problem with ''.'' in :id parameter (must be escaped!)
Hi, I have this very normal link_to call: <%= link_to name, tag_path(name) %> The ''name'' can be something like "ASP.NET". That results in a URL like 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%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 Any advice? TIA, Michael -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Michael Hasenstein
2008-Jun-13 14:32 UTC
Re: link_to problem with ''.'' in :id parameter (must be escaped!)
Well, I solved it with this line: <%= link_to name, ''/tag/''+name.gsub(''.'',''%2E''), :class => css_class %> -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---