My files are stored in app/assets/images/subdirectory/image.png and app/assets/images/subdirectory/image_full.png.
In my app/views/home.html.erb:
<%= link_to (image_tag("subdirectory/image.png"), asset_path("subdirectory/image_full.png")) %>
I've also tried:
<%= link_to (image_tag("subdirectory/image.png"), asset_path("subdirectory/image_full.png", image)) %>
<%= link_to (image_tag("subdirectory/image.png"), image_path("subdirectory/image.png", image)) %>
Couldn't find much via the docs: http://guides.rubyonrails.org/asset_pipeline.html
But it totally crashes my app when I attempt to load the view!
There SHOULD BE NO WHITESPACE AFTER link_to if there is also a paren:
<%= link_to(image_tag("subdirectory/image.png"), image_path("subdirectory/image_full.png", image)) %>
<%= link_to image_path("subdirectory/image_full.png") do %>
<%= image_tag "subdirectory/image.png" %>
<% 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