(I am currently on preview though).
For instance, callbacks in embedded objects should be executed within force, which will ensure that operations are enabled.
The before- and after validation is ran cos parent will validate associated. Thus, we don't need to run validations in the embeds_many proxy's parent_will_be_saved! Save is stilled applied, so the rest of the callbacks are applied thereafter. Now, there is a problem with embedded before-callbacks. Normally, returning false inside of one will short circuit the save call, but in this case it does not.
Fixed a couple of cases when validations where running "wild" on embedded. Dunno if I have fixed it all, but at least it behaves a bit nicer now.
..or else record will contain callback history for creations as well. I see two problems with the situation as it is now: 1. Calling save on an embedded record when the owner is not persisted will call save on the same record again when owner is saved and informs embeds many proxy that it is being about to be saved. Resulting in all callbacks fire again on the record which issued the save in the first place. 2. Calling save on an embedded record when the owner is not persisted will first validate the embedded record, then the owner will validate all associated records, including the one record which issued the save and therefor is validated. (..there might be more situations as well)
..and not surprisingly - the callbacks related to embedded records is a bit fucked up.
…ection. This should fix #72.
In fact; record.freeze returns record.
This fixes #73.
Fixes #75. The problem was: a = User.new :email => "wefwef" => #<User id: "15", ….. > a.email_changed? => false ruby-1.9.2-p180 :003 > a.email = "dfgdfg" => "dfgdfg" ruby-1.9.2-p180 :004 > a.email_changed? => true a.email_changed? will now return true on first query.
It will now simply use the x number of arguments the initializer is expecting. 3 for Date and 6 for Time.
I don't know if we need to take care of this in another way, but as far as I see now; if the user chooses to manipulate the values sent via Rails' form date/time helpers, then we just don't care and we do set the value to nil silently. This should complete #71.
Need to try more values which might triggers some parse errors, like non integer string values etc.
Time will come next.
Maybe it should be settable per class as well?
Makes it easier to read raw_data hash on records.
But: pushing invalid records on to embeds_collection accepts them, but does not save parent.
This completes #56, even though I guess we'll get stuff to fix after actually beginning to use this in the front-application for Companybook.