[Rails] Re: Escaping characters in links
That is did not seem to work. I got a routing error.
<%= link_to CGI::escape(type.name), types_path(CGI::escape(type.name))
%>
The name of the link is appropriately displayed with the "/" replaced
but the link is not.
On May 22, 12:14 am, tommy xiao <xia...@gmail.com> wrote:
> hi, have a try:
> <%= link_to type.name, "#{types_path(type.name)}" %>
>
> keep the second parameter is string,right?
>
> 2011/5/21 tashfeen.ekram <tashfeen.ek...@gmail.com>
>
>
>
>
>
>
>
>
>
> > I have the below link I am generating and type.name returns some
> > strings with a forward slash ("/"). This of course messes up routing.
> > I would like to escape it to %2F however I am unclear on how to do
> > that.
>
> > <%= link_to type.name, types_path(CGI::escape(type.name)) %>
>
> > If I do the below. it gives a no route error.
>
> > <%= link_to type.name, types_path(CGI::escapeHTML(type.name)) %>
>
> > Thanks.
>
> > --
> > 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@googlegroups.com.
> > To unsubscribe from this group, send email to
> > rubyonrails-talk+unsubscribe@googlegroups.com.
> > For more options, visit this group at
> >http://groups.google.com/group/rubyonrails-talk?hl=en.
>
> --
> Deshi Xiao
> Twitter: xds2000
> E-mail: xiaods(AT)gmail.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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home