Is there a shortcut to indicate the limit and order when accessing the has_many relation in the ActiveRecord model?
For example, here is what I would like to express:
@user.posts(:limit => 5, :order => "title")
Unlike the longer version:
Post.find(:all, :limit => 5, :order => "title", :conditions => ['user_id = ?', @user.id])
I know that you can specify it directly in the has_many relationship, but is there a way to do this on the fly, for example, showing 10 posts on one page, but only 3 on another?
Micah source share