提交 9a21774d 编写于 作者: S Sean Griffin

Go through normal where logic in destroy

Building the Arel AST, and manipulating the relation manually like this
is prone to errors and breakage as implementation details change from
underneath it.
上级 aa31d21f
......@@ -495,15 +495,7 @@ def destroy_row
end
def relation_for_destroy
pk = self.class.primary_key
column = self.class.columns_hash[pk]
substitute = self.class.connection.substitute_at(column)
relation = self.class.unscoped.where(
self.class.arel_table[pk].eq(substitute))
relation.bind_values = [[column, id]]
relation
self.class.unscoped.where(self.class.primary_key => id)
end
def create_or_update(*args)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册