find_by_xxx incorrectly adds LIMIT 1

Hi Gioele,

Gioele Barabucci wrote:

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?

Review.find_all_by_product_id(5)

If you wanted to limit the result set you'd need to move to the :conditions => [,] syntax and use :limit

hth, Bill