rails include with options
Posted
by holden
on Stack Overflow
See other posts from Stack Overflow
or by holden
Published on 2009-09-29T09:28:02Z
Indexed on
2010/06/09
23:02 UTC
Read the original article
Hit count: 268
Is it possible to limit an AR :include to say only pull in one record...
Item.find(:all,
:include => [ :external_ratings, :photos => LIMIT 1 ])
I have a list of items and each item has between 5 and 15 photos. I want to load a photo id into memory, but i don't need all of them, I just want to preview the first one.
Is there a way to do this?
© Stack Overflow or respective owner