#1336 ✓resolved

custom properties in unsaved associations are reverted to dumped_value rather than loaded_value

Reported by Ryan | June 23rd, 2010 @ 11:16 PM | in 1.1

I have a model (e.g., Person) with a custom property (e.g., Enum or Flag) and a one-to-many relationship with another model (e.g., Post). If I instantiate a Person (without saving), then associate it with a Post, the value of the custom property is reverted to the dumped value, rather than the loaded_value, as would be correct.

I made a test case here:

It appears to be related to the default_attributes being stored by the collection (in the method DataMapper::Collection#default_attributes). Storing condition.loaded_value rather than condition.value seems to fix it.

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

Referenced by