diff options
author | Emilio Tagua <miloops@gmail.com> | 2009-05-05 10:14:28 -0300 |
---|---|---|
committer | Emilio Tagua <miloops@gmail.com> | 2009-05-05 10:14:28 -0300 |
commit | a83a1ccebaaae5e05741ebd5d9db408c450df098 (patch) | |
tree | 79dc5924ce11481674180e1d216ec6551e634011 /activerecord/lib/active_record/associations/association_collection.rb | |
parent | d19d4d2f20d87289eaeaa8df807d635ce72f3799 (diff) | |
parent | d4402c5554a0d3202fc22eb38c5c1a8c4b9afd93 (diff) | |
download | rails-a83a1ccebaaae5e05741ebd5d9db408c450df098.tar.gz rails-a83a1ccebaaae5e05741ebd5d9db408c450df098.tar.bz2 rails-a83a1ccebaaae5e05741ebd5d9db408c450df098.zip |
Merge commit 'rails/master'
Diffstat (limited to 'activerecord/lib/active_record/associations/association_collection.rb')
-rw-r--r-- | activerecord/lib/active_record/associations/association_collection.rb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/associations/association_collection.rb b/activerecord/lib/active_record/associations/association_collection.rb index 3aef1b21e9..26987dde97 100644 --- a/activerecord/lib/active_record/associations/association_collection.rb +++ b/activerecord/lib/active_record/associations/association_collection.rb @@ -399,11 +399,14 @@ module ActiveRecord find(:all) end - @reflection.options[:uniq] ? uniq(records) : records + records = @reflection.options[:uniq] ? uniq(records) : records + records.each do |record| + set_inverse_instance(record, @owner) + end + records end private - def create_record(attrs) attrs.update(@reflection.options[:conditions]) if @reflection.options[:conditions].is_a?(Hash) ensure_owner_is_not_new @@ -433,6 +436,7 @@ module ActiveRecord @target ||= [] unless loaded? @target << record unless @reflection.options[:uniq] && @target.include?(record) callback(:after_add, record) + set_inverse_instance(record, @owner) record end |