Changeset #2434 [http://dev.rubyonrails.org/changeset/2434] adds back
the assumption that model.valid? == model.save.
I was attempting to change the behavior of
ActiveRecord::StaleObjectError exceptions into being a base error in the
model. This can’t be done because save_with_validation ignores any
errors codes returned by it’s call chain of aliased updates. This
assumption means that any error that is not a validateable must be an
exception, which is what StaleObjectError is. However, to turn it into
an error in the model-- it has to hit the database as an update. There
is no way around this. If it checked the database in a validator, then
something else could still update it before the update command fired.
What I want is on a StaleObjectError to show a diff of the two records
in the base errors list. I’d prefer to do this with minimal mods to the
framework such that none of the existing code has to add error handlers
or other special devices. If I catch the error at a higher level and add
a new routine into the chain, it doesn’t call any of the call backs or
Comments? Suggestions? Ideas? Bueler?