activerecord/lib/active_record/associations/collection_association.rb
# Implements the ids writer method, e.g. foo.item_ids= for Foo.has_many :items
Implements the ids writer method, e.g.
Implements the ids writer method e . g .
def ids_writer(ids)
        pk_type = reflection.primary_key_type
        ids = Array(ids).reject(&:blank?)
        ids.map! { |i| pk_type.cast(i) }
        records = klass.where(reflection.association_primary_key => ids).index_by do |r|
          r.send(reflection.association_primary_key)
        end.values_at(*ids)
        replace(records)
      end
def ids_writer ( ids ) pk_type = reflection . primary_key_type ids = Array ( ids ) . reject ( & :blank? ) ids . map! { | i | pk_type . cast ( i ) } records = klass . where ( reflection . association_primary_key => ids ) . index_by do | r | r . send ( reflection . association_primary_key ) end . values_at ( * ids ) replace ( records ) end
Implements the ids writer method, e.g.
Implements the ids writer method e . g .
ids
<not_specific>