What I want to be able to do is check to see if the parent object of
one of my models exists and is valid before saving it and fix it if
necessary. The problem is that the `before :save` hook is run _after_
the parents are saved and _only_ if the parents are valid and saved
properly. This causes interesting situations where the save fails but
the object has no errors.

 In 0.10.1, I was using a before hook on the private API method
`save_parents`, but in 0.10.2 that no longer works(which I'm cool
with, my fault for using the private API). I'm thinking I'll just move
the code that fixes up the parent up a level, since I only use it once
or twice. But, it would be better encapsulated where it is now. I'd
prefer to find another way to do this inside my models.

using save_parents
http://gist.github.com/219072

interesting validation behavior and doing it outside the hook
framework
http://gist.github.com/271337
-- 
You received this message because you are subscribed to the Google Groups 
"DataMapper" group.
To post to this group, send email to datamap...@googlegroups.com.
To unsubscribe from this group, send email to 
datamapper+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/datamapper?hl=en.


Reply via email to