diff options
author | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2012-08-18 18:11:11 -0700 |
---|---|---|
committer | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2012-08-18 18:11:11 -0700 |
commit | f9fc26e8007d5e2936cf5374a8168b2c37273490 (patch) | |
tree | 8d51ff8b59889e518b2c5a8450983af0b48ab068 /activerecord/lib/active_record | |
parent | af26adcffbf97e8f7abdd63d0a4d501c70250a09 (diff) | |
parent | c9c5566acef049f924ade61da2247a5c9456eba0 (diff) | |
download | rails-f9fc26e8007d5e2936cf5374a8168b2c37273490.tar.gz rails-f9fc26e8007d5e2936cf5374a8168b2c37273490.tar.bz2 rails-f9fc26e8007d5e2936cf5374a8168b2c37273490.zip |
Merge pull request #7377 from brainopia/use_inversed_parent_for_first_and_last_child
Use inversed parent for first and last child of has_many association
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r-- | activerecord/lib/active_record/associations/collection_association.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/associations/collection_association.rb b/activerecord/lib/active_record/associations/collection_association.rb index a84eda1d3b..b15df4f308 100644 --- a/activerecord/lib/active_record/associations/collection_association.rb +++ b/activerecord/lib/active_record/associations/collection_association.rb @@ -574,7 +574,7 @@ module ActiveRecord args.shift if args.first.is_a?(Hash) && args.first.empty? collection = fetch_first_or_last_using_find?(args) ? scope : load_target - collection.send(type, *args) + collection.send(type, *args).tap {|it| set_inverse_instance it } end end end |