ruby on rails - Use an image path from database as link_to -


i have image being pulled database in table, make link viewer can taken full article. have seen in theory use below,

<%= link_to image_tag('image/someimage.png') + "some text", some_path %> 

but in case 'image/someimage.png'

<%= image_tag coffeeshop.image_thumb_path %> 

i've tried dropping image tag section in, becomes <%= link_to image_tag('image_tag coffeeshop.image_thumb_path') + "some text", some_path %> doesn't work. there way this?

link_to(body, url, html_options = {}) 

the first argument in link_to interpreted body of tag, , url, if want add more content inside link_to can open , close it, inside interpreted way:

<a href="#">   ... </a> 

so can try:

<%= link_to some_path %>   <%= image_tag coffeeshop.image_thumb_path %> <% end %> 

Comments

Popular posts from this blog

javascript - Confirm a form & display message if form is valid with JQuery -

Retrieving ETA (estimated time of arrival) with Google Distance Matrix API and public transit as transport mode -

ionic framework - Meteor - Error: Failed to execute 'insertBefore' on 'Node' -