This project is archived and is in readonly mode.
Changeset [aef47dcf937a5c9f150c50b73cffd9fa9eb64915] by Tim Harper
May 31st, 2008 @ 09:23 PM
belongs_to polymorphic association assignments update the foreign_id and foreign_type fields regardless of whether the record being assigned is new or not.
fixes the following scenarios:
- I have validates_inclusion_of on the type field for a polymorphic belongs_to association. I assign a new record to the model's polymorphic relationship of the proper type. validation fails because the type field has not been updated.
- I replace the value for a ppolymorphic association to a new record of another class. The type field still says its the previous class, and the id field points to the previous record as well.
Committed by Repository
- M activerecord/lib/active_record/associations/belongs_to_polymorphic_association.rb
- M activerecord/test/cases/associations/belongs_to_associations_test.rb
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>