This project is archived and is in readonly mode.
Belongs to polymorphic association assignment with new records doesn't update foreign id or type
-
Rick
- Milestone set to 2.1.1
- State changed from new to open
- Assigned user set to Rick
-
Rick
- Milestone cleared.
- State changed from open to new
- Title changed from Belongs to polymorphic association assignment with new_records doesn't update to Belongs to polymorphic association assignment with new records doesn't update foreign id or type
-
Rick
- State changed from new to open
-
Tim Harper
Is this patch not going to make it into 2.1 ?
-
Repository
(from [0580b31b36c0f7dd1a0f8bdd1b1806e3bd65b22d]) 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.
[#191 state:closed]