From fbf9281f0e3ced714bc534821c8b241ed7ec358e Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Fri, 31 Dec 2004 19:38:04 +0000 Subject: Added automated optimistic locking if the field lock_version is present #384 [Michael Koziarski] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@295 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- activerecord/CHANGELOG | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'activerecord/CHANGELOG') diff --git a/activerecord/CHANGELOG b/activerecord/CHANGELOG index b97085cdba..8a0d75ee8a 100644 --- a/activerecord/CHANGELOG +++ b/activerecord/CHANGELOG @@ -1,5 +1,23 @@ *SVN* +* Added automated optimistic locking if the field lock_version is present. Each update to the + record increments the lock_version column and the locking facilities ensure that records instantiated twice + will let the last one saved raise a StaleObjectError if the first was also updated. Example: + + p1 = Person.find(1) + p2 = Person.find(1) + + p1.first_name = "Michael" + p1.save + + p2.first_name = "should fail" + p2.save # Raises a ActiveRecord::StaleObjectError + + You're then responsible for dealing with the conflict by rescuing the exception and either rolling back, merging, + or otherwise apply the business logic needed to resolve the conflict. + + #384 [Michael Koziarski] + * Added :counter_cache option to acts_as_tree that works just like the one you can define on belongs_to #371 [Josh] * Fixed quoting in validates_format_of that would allow some rules to pass regardless of input #390 [Dmitry V. Sabanin] -- cgit v1.2.3