Further conversation on the internets:

16:46:31 < knowtheory> btw ppls i'd be interested to hear if the problem i
posted to the mailing list has bitten anybody else
16:46:42 < knowtheory> postmodern & myabc & everyone else :)
16:47:16 < myabc> knowtheory: oh yes! ;)
16:48:09 < knowtheory> o? :D care to toss anything back in response? XD
16:50:57 < myabc> knowtheory: well, wine tends to make me less responsive..
but I find myself having to write code (hackier versions of
solnic/dm-validations-ext) to deal with child associations in real-world
projects.
16:53:35 < myabc> knowtheory: I've also hit a snag in a plugin I'm working
on where I have an object for which #save returns true (but the object is
not persisted and #dirty? == true) and #valid? and #query_valid? also return
true.. and I'm wondering if something is awry elsewhere in the object graph.
16:53:53 < myabc> (caveat: may be completely unrelated ;) )
16:53:53 < knowtheory> heh is that in a hook? :D
16:54:05 < myabc> yes
16:54:15 < knowtheory> well there's yer problem ;)
16:54:18 < knowtheory> we were just discussing this yesterday
16:54:22 < myabc> how did you know ;)
16:54:28 < myabc> ?
16:54:33 < postmodern> knowtheory, i did have similar problems
16:54:34 < myabc> knowtheory: should I override _save?
16:54:42 < postmodern> knowtheory, but ended up being my fault with
dm-is-read_only
16:54:59 < knowtheory> myabc: depends if you need to save the entire graph.
 if yo just need to save that one model, you can do a self.send(:save_self)
16:55:04 < postmodern> knowtheory, since the state code assumes that a
Immutable object isn't saved
16:55:37 < knowtheory> this is due to the "run_once" mechanism which doesn't
allow #dirty? or #save to be run from the same method invocation more than
once
16:55:44 < myabc>
http://github.com/myabc/friendly_id_datamapper/blob/cached-slugs/lib/friendly_id/datamapper_adapter/slugged_model.rb#L114-117
16:55:46 < knowtheory> it's basically a way to keep users from causing
infinite loops
16:55:49 < knowtheory> but everyone trips over it.
16:56:23 < myabc> knowtheory: oh right.. I had forgotten that was the case
16:56:50 < knowtheory> so, proposed solution is to let you call #save!
inside of an after save... but i'm not positive tha'tll work yet.
16:57:08 < knowtheory> dkubb|away is hesitant to try and perform any save
behavior w/in the context of another save
16:58:42 < knowtheory> postmodern: but see, the freaking validations system
should be aware of why an object can't save
16:58:46 < knowtheory> that's the whole point of it's existence :P
16:59:31 < myabc> knowtheory: amen.. it means much less head scratching in
real-world projects
17:02:09 < knowtheory> heh, i'm tempted just to copypasta this conversation
into the email thread
17:02:22 < myabc> knowtheory: fine by me!
17:06:29 < postmodern> knowtheory, yes it should
17:06:41 < postmodern> knowtheory, and not being able to find a validation
error keeps bitting users

-- 
You received this message because you are subscribed to the Google Groups 
"DataMapper" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/datamapper?hl=en.

Reply via email to