ruby on rails - How to place an image inside of a link? -
i'm trying simple, inside link want there text , image.
= link_to 'nvidia graphics', inventory_url, class: 'lato' = image_tag 'list-highlighter.png'
i'd output like:
<a href="/inventory"> nvidia graphics <img src="list-highlighter.png" /> </a>
how can achieve using slim? current code causes website crash.
undefined method `stringify_keys' "http://foobar.com/inventory":string
= link_to inventory_url, class: 'lato' | nvidia graphics = image_tag 'list-highlighter.png'
i think should work.. not 100% slim syntax. link_to
shouldn't have content when wrapping block -- is, should followed url. content inside wrapped <a>
tag output. non-slim, like
<%= link_to inventory_url, class: 'lato %> nvidia graphics <%= image_tag 'list-highlighter.png' %> <% end %>
Comments
Post a Comment