link_to displaying html instead of link

I am learning to use Helpers in Rails 3.
I have a project model with 'Name' attribute in it. I want to display
all the Projects with a 'Show' link next to it. The Problem is instead
of displaying a link for 'Show' it is displaying the html(<a
href="/projects/1"><img alt="Show"
src="/images/icons/show.png?1285276800" /></a>

--Here is my app/views/projects/index.html.erb

<title> <p> Projects </p></title>
<%= render @projects %>


<div class="project">
<%= project_title_links(project) %>


module PeopleHelper
  def project_title_links(project)
    content_tag :h1 do
      [ project.title,
     link_to_icon('show', project)
      ].join(' ')


module ApplicationHelper

  def link_to_icon(icon_name, url_or_object, options={})


helpers are automatically scrubbed in rails 3. Try adding .html_safe to the return value

Thanks for your response. I tried adding .html_safe to the following,
but its still outputting the same.


<div class="project">
<%= project_title_links(project).html_safe %>

Hi Ravi,

Its because with rails3 they have implemented script safety by
default. If you want to print html/script codes you need to
explicitly declare it. try this

<%= raw project_title_links(project) %>

should work



Although this will work, it seems like bad form to do this for helpers in the view.
IMO, if the helper is intended to return renderable html, it should. Simply add .html_safe to
the end of .join() in your helper --> .join(' ').html_safe

Hope this helps

Perfect - that did it. Thank You so much for your help! I appreciate it.