0

The products API gives me name, price, and images keys. It's easy to display name and price since they are not nested. However, to display images, I have to target their urls which are nested. How can I display these images? They have a normal url, it's just I do not know how to target them.

Displaying the API

table.table.table-condensed
        thead
          tr
            th Name
            th Price
            th Image
        tbody
          - @products.each do |product|
            tr
              td= product.name
              td= product.price
              td #display images here

I use ActiveResource.

Can somebody help? I'm pretty stuck now.

atw
  • 5,428
  • 10
  • 39
  • 63
Roland Jegorov
  • 789
  • 1
  • 11
  • 27

1 Answers1

0

Just iterate over image objects use each method:

- product.images.each do |image|
  = image_tag image.url
Maxim
  • 9,701
  • 5
  • 60
  • 108