I have Products and Reviews; Product :has_many reviews, Review
:belongs_to product.
Review.find_by_product_id(5) returns only one Review because it is
incorrectly translated into (MySQL) “SELECT * FROM reviews WHERE
(reviews.product_id
= 5) LIMIT 1”. So
Product.find(5).reviews.count
=> 6
Review.find_by_product_id(5)
=> #<Review:0x2b1cefb2a1d8 @attributes=…>
How can I tell Rails that Review.find_by_product_id should return a
collection and not a single result?
–
Gioele