>> My more immediately point is that it is hard, if not impossible, to
>> write correct code currently with DM.
> Now that's just hyperbole. Let me state, that off the top of my head,
> a false save should only occur due to validation failures. If that's
> not the case in your experience with DM definitely let me know because
> that's the intent.
...
> Like I said, if
> #save returns false in cases other than validation failures, it's a
> bug.
Not exactly court enforceable, but I'll take it. If you really feel
that way, I think the method contract should be changed to reflect
this.
It's not that I have experienced other save failures, it's that when I
write the code to handle the failures I get this uncomfortable "I'm
writing shitty code" feeling, because there are clear cases that I may
not be covering.
I don't think it's hyperbole to say that you can't write "correct"
code without that guarantee, unless you're ok with putting this in
every single save call (can't think of a way to do it in an after hook
since you can't get the return value to my knowledge):
unless foo.save
if foo.errors.length > 0
raise UnknownSaveFailure(foo)
else
log "Invalid record: ..."
end
end
Thanks again. Generally DM has been awesome, even if I disagree on
this point.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---