Forum: Ruby on Rails limit number of results from dynamic finders

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Ehud R. (Guest)
on 2007-05-05 03:53
Hi everyone,
I'm looking for a way to limit the number of results returned by the
select genereted when I use the following syntax:
User.posts.each { |post| ... }

I'm not sure those are dynamic finders per se, but I'm not familier with
the correct term. any way, I'd like to only select the first 5 posts
withut using find_by_sql or find(:all, :limit => 5).

Is that possible?

Thanks,
Ehud
This topic is locked and can not be replied to.