提交 d29d793c 编写于 作者: E Emilio Tagua 提交者: Aaron Patterson

Don't create local vars.

上级 6ffe0ef5
......@@ -110,12 +110,9 @@ def destroy #:nodoc:
return super unless locking_enabled?
if persisted?
lock_col = self.class.locking_column
previous_value = send(lock_col).to_i
table = self.class.arel_table
predicate = table[self.class.primary_key].eq(id)
predicate = predicate.and(table[self.class.locking_column].eq(previous_value))
predicate = predicate.and(table[self.class.locking_column].eq(send(self.class.locking_column).to_i))
affected_rows = self.class.unscoped.where(predicate).delete_all
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册