Skip to content

Commit

Permalink
lock_optimistically is typically true, so evaluate the common failure…
Browse files Browse the repository at this point in the history
… case first
  • Loading branch information
tenderlove committed Jun 28, 2011
1 parent 02f45d6 commit 13e79eb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion activerecord/lib/active_record/locking/optimistic.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 13e79eb

Please sign in to comment.