0
I need help displaying in the view the value in the view of a relationship with has_many.
I have my product model:
class Product < ActiveRecord::Base
paginates_per 15
has_many :product_images, :dependent => :delete_all
I’m doing a find on this model:
@products = Product.where(:active => 1).includes(:product_images)
But I can’t do it for example
@product.image_products.id
What is wrong? Thank you.
thanks helped yes was breaking the head, but this solution was quite useful. But even in Rails 5 as you mentioned it is possible to pass 2 attributes I found still a little limited.
– mluiz