1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

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.
This commit is contained in:
Sean Griffin 2015-01-14 15:08:03 -07:00
parent aa31d21f5f
commit 9a21774d73

View file

@ -495,15 +495,7 @@ module ActiveRecord
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)