Question

I have a table with several attributes, one of those attributes is a field wich contents the facebook links.

I'm showing this link in table like that:

<% @hr_curriculum_interns.each do |hr_curriculum_intern| %>
  ...
  <td><%= hr_curriculum_intern.facebook %></td>
  ...
<% end %>

But now, I want show only a icon instead the link, so, I search and I dont found. I tried do this with many ways, like that:

 <td><%= link_to image_tag('icons/facebook.png', {:alt=>"Alt title", :title => hr_curriculum_intern.facebook}), :href=> hr_curriculum_intern.facebook %></td>

But, they doesn't work, when I click in link, I'm not direct for facebook page's.

What I'm doing wrong?

Ps: Please, sorry for my english, I hope you can to understand

Update

That way worked for me:

  <%= link_to (image_tag('icons/linkedin.png', :width => "20", :height => "20")), "http://#{hr_curriculum_generic.facebook}" %>

Thanks a lot for help =]

Was it helpful?

Solution

Try using this one

<%= link_to (image_tag('icons/facebook.png', {:alt=>"Alt title", :title => hr_curriculum_intern.facebook})), hr_curriculum_intern.facebook %>

OTHER TIPS

I suggest you use link_to with a block

<td>
  <%= link_to hr_curriculum_intern.facebook do %>
    <%= image_tag('icons/facebook.png', {:alt=>"Alt title",
                                         :title => hr_curriculum_intern.facebook})
    %>
  <% end %>
</td>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top