.sync() for ActiveRecord objects

Hi everybody,

the other day, I thought it may be useful to have a .sync() method on
ActiveRecord objects. The behavior would be something between a
.reload() and a .save().

- At every reload, an internal hash would store the attributes as they
were in the db at reload time (think svn's working-base)
- whenever attributes are changed on the object, the values of that
hash would remain untouched
- whenever sync is called, the tuple gets reloaded from the db and both
the current db tuple and the current object attribute values are
compared to the working-base hash. if changes were made on the object,
they get populated to the db and vice versa.
- conflicts could result in exceptions or there could be defaults like
my_object.sync :on_conflict_follow => :database

I didn't have time to implement this so far, but I wanted to share this
idea and get feedback. What do you think?



check out acts_as_modified plugin