I have Questions
with Tags
.
When you click a tag name, it takes you to /tagname
.
E.g. clicking ruby
takes you to /ruby
.
But, there are some tag names that need to be HTML escaped (e.g. c#
or .net
, etc.).
How do I do that?
I tried doing params[:tag].html_safe
in my controller, but that doesn't do it because the params are being sent incorrectly before.
E.g. this is what the log looks like when I do click on the c#
tag (or I manually type in c#
in the URL).
Started GET "/c" for 127.0.0.1 at 2013-03-29 07:31:46 -0500
Processing by HomeController#index as HTML
Parameters: {"tag"=>"c"}
Tag Load (26.7ms) SELECT "tags".* FROM "tags" WHERE "tags"."name" = 'c' LIMIT 1
This is what my route looks like:
get ':tag', to: 'home#index', as: :tag