I added an image inside a link_to
helper:
<% like = image_tag("like.png", :alt => "like", :class => "like") %>
<%= link_to like, vote_up_path(@votable, :votable_type => "Post"), :remote => true, :class => "vote-up default button" %>
How can I do it so that I can place some text within the link and right after the image (like the like button in YouTube)?
You can pass a block to the link_to
helper
<%= link_to vote_up_path(@votable, :votable_type => "Post"), :remote => true, :class => "vote-up default button" do %>
<%= image_tag("like.png", :alt => "like", :class => "like") %>
<span>Like</span>
<% end %>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With