mirror of
https://github.com/github/rails.git
synced 2026-01-09 14:48:01 -05:00
Revert "Revert "Merge pull request #10901 from armstrjare/fix_query_null_foreign_key_on_new_record_collection_ids_reader""
This reverts commit 5009b07887.
Also updated the CHANGELOG and adjusted the test-case to match the one on master.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user