diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2011-06-28 10:51:23 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2011-06-28 10:51:23 -0700 |
commit | 13e79eb6c387f1af1551a53df1b5620e41c6da90 (patch) | |
tree | d2470cd576654fb0df0250257e28fed5a49a16b9 /activerecord/lib/active_record/locking | |
parent | 02f45d6e0ca0a3e6f5fc30b2c99bedee27484197 (diff) | |
download | rails-13e79eb6c387f1af1551a53df1b5620e41c6da90.tar.gz rails-13e79eb6c387f1af1551a53df1b5620e41c6da90.tar.bz2 rails-13e79eb6c387f1af1551a53df1b5620e41c6da90.zip |
lock_optimistically is typically true, so evaluate the common failure case first
Diffstat (limited to 'activerecord/lib/active_record/locking')
-rw-r--r-- | activerecord/lib/active_record/locking/optimistic.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/locking/optimistic.rb b/activerecord/lib/active_record/locking/optimistic.rb index 3afa257a76..6cfce6e573 100644 --- a/activerecord/lib/active_record/locking/optimistic.rb +++ b/activerecord/lib/active_record/locking/optimistic.rb @@ -73,7 +73,7 @@ module ActiveRecord # <tt>locking_enabled?</tt> at this point as # <tt>@attributes</tt> may not have been initialized yet. - if lock_optimistically && result.include?(self.class.locking_column) + if result.key?(self.class.locking_column) && lock_optimistically result[self.class.locking_column] ||= 0 end |