Permalink
Browse files

lock_optimistically is typically true, so evaluate the common failure…

… case first
  • Loading branch information...
1 parent 558b5bb commit d8646163e55e7aee3ba1d428c7fa101abf96771d @tenderlove tenderlove committed Jun 28, 2011
Showing with 1 addition and 1 deletion.
  1. +1 −1 activerecord/lib/active_record/locking/optimistic.rb
View
2 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 d864616

Please sign in to comment.