search for: primary_key_column

Displaying 1 result from an estimated 1 matches for "primary_key_column".

2012 Nov 03
0
ids writer fields for HABTM relationship.
...h the help of pry and pry-debugger, i have pinpointed the exact source of the "NoMethodError" error (in collection_association.rb, at line 69): [code] # Implements the ids writer method, e.g. foo.item_ids= for Foo.has_many :items def ids_writer(ids) pk_column = reflection.primary_key_column ids = Array.wrap(ids).reject { |id| id.blank? } ids.map! { |i| pk_column.type_cast(i) } replace(klass.find(ids).index_by { |r| r.id }.values_at(*ids)) end [/code] This method gets called by the People controller in the update action (@person.update_attributes params[:perso...