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

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -