Reputation: 11797
Unfortunately the below is not working for me @shps is a list of urls.
<h1>Shewps</h1>
<% @shps.each do |shp| %>
<%= image_tag(shp) %>
<% end %>
The HTML I get is as follows:
<img alt="#<shp:0xa0c5af8>" src="/assets/#<Shp:0xa0c5af8>">
It seems shp is returning an object?, when i use shp outside of the image tag it returns as a string. Also it is looking in ./assets/ when it is an external url.
Upvotes: 0
Views: 825
Reputation: 11797
Turns out I needed to call shp.url , url being one of the attributes for my model. shp returns the entire object.
Upvotes: 0
Reputation: 51151
Instead of passing ActiveRecord
object, you should pass actual url to image_tag
method. So, assuming you store it in url
column:
<% @shps.each do |shp| %>
<%= image_tag shp.url %>
<% end %>
Upvotes: 2