I am new to Ruby and am pretty sure that this has a very easy
solution. I am querying an Amazon wishlist but am not sure how to
display all of the results in the view. Following is the code with
comments. Any help would be appreciated.
<!-- DEBUGGING Trying display all results. Currently only displays
the first result -->
<a href="<%= @url %>"><%= @product_name %> <img src="<%= @image_url
%>" class="" border="0" alt="Falling Up" /> </a></br>
List Price: <%= @list_price %></br>
Our Price: <%= @our_price %></br>
</br></br>
<!-- END DEBUGGING Trying display all results. Currently only
displays the first result -->
<!-- DEBUGGING Displays all items but cannot filter for only the ones
I want -->
<% for item in @response %>
Array Item: <%= item %><br/>
<% end %>
<!-- End DEBUGGING Displays all items but cannot filter for only the
ones I want -->
I am new to Ruby and am pretty sure that this has a very easy
solution. I am querying an Amazon wishlist but am not sure how to
display all of the results in the view. Following is the code with
comments. Any help would be appreciated.
<% @products.each do |product| %>
<%= product.product_name %>
List Price: <%= product.list_price
%>
Our Price: <%= product.our_price %>
<% end %>
You should investigate the link_to and image_tag helpers to help clean up your views. After you’re comfortable with that the next level would be extracting the contents of the loop into a partial.