aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib
diff options
context:
space:
mode:
authorLuca Guidi <guidi.luca@gmail.com>2008-11-02 10:36:38 +0100
committerLuca Guidi <guidi.luca@gmail.com>2008-11-02 10:36:38 +0100
commit27ec3ee00975a6655d2949520a6545e831751024 (patch)
tree0f9634bd1b2ed024522f57e32bbb91fcd8b95017 /activerecord/lib
parent1147453fce0890ea229c3af5f43c909ebe53061e (diff)
downloadrails-27ec3ee00975a6655d2949520a6545e831751024.tar.gz
rails-27ec3ee00975a6655d2949520a6545e831751024.tar.bz2
rails-27ec3ee00975a6655d2949520a6545e831751024.zip
Made more clear the case of ignored :limit option for eager loaded associations
Diffstat (limited to 'activerecord/lib')
-rwxr-xr-xactiverecord/lib/active_record/associations.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb
index 84caca3518..c7cb6eb966 100755
--- a/activerecord/lib/active_record/associations.rb
+++ b/activerecord/lib/active_record/associations.rb
@@ -507,6 +507,14 @@ module ActiveRecord
#
# will load posts and eager load the +approved_comments+ association, which contains only those comments that have been approved.
#
+ # If you eager load an association with a specified <tt>:limit</tt> option, it will be ignored, returning all the associated objects:
+ #
+ # class Picture < ActiveRecord::Base
+ # has_many :most_recent_comments, :class_name => 'Comment', :order => 'id DESC', :limit => 10
+ # end
+ #
+ # Picture.find(:first, :include => :most_recent_comments).most_recent_comments # => returns all associated comments.
+ #
# When eager loaded, conditions are interpolated in the context of the model class, not the model instance. Conditions are lazily interpolated
# before the actual model exists.
#