rails 3 helpers

This code outputs html to the page not the icons, ideas?

def pub_social_links(pub)
html = “”
twit = pub.twitter.blank? ? [‘off’,"#{pub.twitter}",‘disabled’] : [‘on’,’’,’’]
rss = pub.rss.blank? ? [‘off’,"#{pub.rss}",‘disabled’] : [‘on’,’’]
fb = pub.facebook.blank? ? [‘off’,"#{pub.facebook}",‘disabled’] : [‘on’,’’,’’]
html << link_to( “image_tag(‘icons/rss_#{rss[0]}.png’)”, rss[1], :disabled => “#{rss[2]}”)
html << link_to( “image_tag(‘icons/twitter_#{twit[0]}.png’)”, “#{twit[1]}”, :disabled => “#{twit[2]}”)
html << link_to( “image_tag(‘icons/facebook_#{fb[0]}.png’)”, “#{fb[1]}”, :disabled => “#{fb[2]}”)
return html
end

image_tag(‘icons/rss_off.png’)image_tag(‘icons/twitter_off.png’)image_tag(‘icons/facebook_off.png’)

Because you are returnning the helpers as strings, values… not function calls. remove the encapsulating double quotes so that

html << link_to( “image_tag(‘icons/rss_#{rss[0]}.png’)”, rss[1], :disabled => “#{rss[2]}”)

will be

html << link_to(image_tag(‘icons/rss_#{rss[0]}.png’), rss[1], :disabled => “#{rss[2]}”)

Chris Habgood wrote in post #969486:

This code outputs html to the page not the icons, ideas?

Rails 3 escapes HTML by default, remember?

[...]

      html << link_to( "image_tag('icons/rss_#{rss[0]}.png')", rss[1],
:disabled => "#{rss[2]}")

You dont need #{} if there's nothing else in the string -- just use
:disabled => rss[2] .

Best,