On Wednesday, February 6, 2013 6:31:07 AM UTC-8, Edward J wrote:

> Hi,
>
> I have several one_to_many associations and in some cases I would like to 
> limit the number of items to fetch.
>
> Is there a way to Achieve something like
>
> artist = Artist.first
> artist.albums.order(:title).limit(10)
>
> which would result in a query similar to
> select * from albums where artist_id = 123 order by title limit 10
>

The :limit association option does this.

Thanks,
Jeremy 

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sequel-talk?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to