diff options
author | Yves Senn <yves.senn@gmail.com> | 2013-06-25 18:07:06 +0200 |
---|---|---|
committer | Yves Senn <yves.senn@gmail.com> | 2013-06-25 18:07:06 +0200 |
commit | 27b38838467cf47f83caefbddcdb96aceca052ee (patch) | |
tree | 482bd8d1674bf561de15e0e361144cddcb6c121a /activerecord/lib/active_record/associations/collection_association.rb | |
parent | b0c65978ab0eff0eca8ac374046c26398f144a18 (diff) | |
download | rails-27b38838467cf47f83caefbddcdb96aceca052ee.tar.gz rails-27b38838467cf47f83caefbddcdb96aceca052ee.tar.bz2 rails-27b38838467cf47f83caefbddcdb96aceca052ee.zip |
Revert "Revert "Merge pull request #10901 from armstrjare/fix_query_null_foreign_key_on_new_record_collection_ids_reader""
This reverts commit 5009b078875e596a2fba7827336f7548aa6e35ac.
Also updated the CHANGELOG and adjusted the test-case to match the one on master.
Diffstat (limited to 'activerecord/lib/active_record/associations/collection_association.rb')
-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 65e882867e..baddb9852f 100644 --- a/activerecord/lib/active_record/associations/collection_association.rb +++ b/activerecord/lib/active_record/associations/collection_association.rb @@ -43,7 +43,7 @@ module ActiveRecord # Implements the ids reader method, e.g. foo.item_ids for Foo.has_many :items def ids_reader - if loaded? || options[:finder_sql] + if owner.new_record? || loaded? || options[:finder_sql] load_target.map do |record| record.send(reflection.association_primary_key) end |