I’m trying to display a set of images from my database using image_tag, but the loop displays the entire database along with the images.
<%= @tools.each do |tool|%>
<%= link_to( image_tag(tool.image_url, :alt=>"Hello, this is an alt"), "tools/"+tool.id.to_s)%>
<% end %>
This works to display each of the images and link them to the correct spot, but at the end of the images, there’s a bunch of text from the database that shouldn’t be there and I couldn’t figure out how to remove.
I don’t know that it matters, but here’s the text:
[#<Tool id: 3, title: "Screwdriver", description: "a screwdriver", image_url: "1.png", price: #<BigDecimal:4818870,'0.1E1',9(36)>, created_at: "2012-09-16 16:31:10", updated_at: "2012-09-16 16:31:10">, #<Tool id: 5, title: "Hammer", description: "A hammer", image_url: "3.png", price: #<BigDecimal:48167b8,'0.7E1',9(36)>, created_at: "2012-09-20 02:19:35", updated_at: "2012-09-20 02:19:35">]
Any ideas or tips are much appreciated. 🙂
Try
No equal sign.