1

I have a custom array of string urls which im adding to an image_tag as below:

<%=  @attachment.each do |att| %>
<div>
    <%= image_tag att %>
</div>

<% end %>

Images are displayed correctly but im getting the below junk underneath the images:

["http://localhost:8090/download/attachments/884794/DSC_0006.NEF? version=1&modificationDate=1343685834627", "http://localhost:8090/download/attachments/885137/Sunflower.gif?version=1&modificationDate=1343720588175", "http://localhost:8090/download/attachments/885140/Spiked.gif?version=1&modificationDate=1343720548736"]

1 Answer 1

2

Change the very first tag to <% instead of <%=. The equals prints the junk return value of .each.

Sign up to request clarification or add additional context in comments.

2 Comments

awesome, also how would i create a link_to on this? so when the image is clicked it goes to an url?
would it also be possible to pass another parameter such as a pageid which i can work with in the controller? this data is coming from an external xmlrpc call, so i can't use the goodies that rails offers, or can i save data into a fake rails model and be able to use it like a normal rails model?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.