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 46
def ids_reader
if loaded? || options[:finder_sql]
load_target.map do |record|
record.send(reflection.association_primary_key)
end
else
column = "#{reflection.quoted_table_name}.#{reflection.association_primary_key}"
scope.pluck(column)
end
end