Implements the ids reader
method, e.g. foo.item_ids for Foo.has_many :items
# File activerecord/lib/active_record/associations/collection_association.rb, line 49
def ids_reader
if loaded?
target.pluck(reflection.association_primary_key)
elsif !target.empty?
load_target.pluck(reflection.association_primary_key)
else
@association_ids ||= scope.pluck(reflection.association_primary_key)
end
end