method

ids_writer

rails latest stable - Class: ActiveRecord::Associations::CollectionAssociation
ids_writer(ids)
public

Implements the ids writer method, e.g. foo.item_ids= for Foo.has_many :items

1Note

this works, but doesn't make sense

abstraktor ยท Sep 17, 2011

does it?

replace(klass.find(ids).index_by { |r| r.id }.values_at(*ids))

equals replace(klass.find(ids))

I see no point in making it that complicated