Permalink
Browse files

lock_optimistically is typically true, so evaluate the common failure…

… case first
  • Loading branch information...
1 parent 02f45d6 commit 13e79eb6c387f1af1551a53df1b5620e41c6da90 @tenderlove tenderlove committed Jun 28, 2011
Showing with 1 addition and 1 deletion.
  1. +1 −1 activerecord/lib/active_record/locking/optimistic.rb
@@ -73,7 +73,7 @@ def attributes_from_column_definition
# <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

0 comments on commit 13e79eb

Please sign in to comment.