Reputation: 621
I use auto_link in order to generate the clickable url:
<div>
<%= auto_link("Go to http://www.rubyonrails.org") %>
</div>
In the view page, it is supposed to show
Go to http://www.rubyonrails.org
However, it actually shows the HTML code in plain text:
Go to <a href="http://www.rubyonrails.org">http://www.rubyonrails.org</a>
Any suggestion on how to fix this?
Rails version is 3.0.17
Upvotes: 1
Views: 240
Reputation: 34145
By default auto_link returns sanitized html_safe strings. This behaviour can be overriden setting the :sanitize option to false
<%= auto_link("Go to http://www.rubyonrails.org", sanitize: false) %>
Upvotes: 0
Reputation: 14018
It's working as intended, see https://github.com/tenderlove/rails_autolink (which replaces the function that was removed in Rails 3.1)
Upvotes: 0