Clifford,

> In my mind,
> that gives you the choice to either do both updates (my
> preference) or neither, but not to do just one.

The original intention for the #update method in Model, Collection and
Resource is that it be an atomic change and idempotent, sort of
analogous to a PUT HTTP method call.

For now I think I'll probably put into effect Roy's idea, and raise an
exception if you call #update on a dirty resource.  At the very least
that'll prevent people from using the method in a way that wasn't
intended.

> I suppose
> you could justify doing just one *if* you could guarantee
> to make it seem as if that change had occurred before
> the other had seen the attribute you updated, so you
> effectively alter the sequence of changes.

DM has a dirty attribute tracking system that it uses to limit the
data sent over the wire to just dirty attributes.  I think it would be
fairly simple to use this to "stash" the changed values, validate the
object, perform the atomic update, and then restore the state of the
changed attributes.  I think though, that this will need some further
thought, and perhaps a development branch for experimentation.

--

Dan Kubb
(dkubb)
--~--~---------~--~----~------------~-------~--~----~
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