提交 8c9b5e41 编写于 作者: A Aaron Patterson

removing more calls to deprecated methods

上级 ead0c6ee
......@@ -87,11 +87,13 @@ def update(attribute_names = @attributes.keys) #:nodoc:
begin
relation = self.class.unscoped
affected_rows = relation.where(
stmt = relation.where(
relation.table[self.class.primary_key].eq(quoted_id).and(
relation.table[lock_col].eq(quote_value(previous_value))
)
).arel.update(arel_attributes_values(false, false, attribute_names))
).arel.compile_update(arel_attributes_values(false, false, attribute_names))
affected_rows = connection.update stmt.to_sql
unless affected_rows == 1
raise ActiveRecord::StaleObjectError, "Attempted to update a stale object: #{self.class.name}"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册