Make #destroy write 1 line into log (instead of 3) (Dmitry Sokurenko) [#689 status:committed]

This commit is contained in:
David Heinemeier Hansson
2008-10-29 10:53:33 +01:00
parent 4dbfe18b37
commit 8f0f078637

View File

@@ -2410,10 +2410,11 @@ module ActiveRecord #:nodoc:
# be made (since they can't be persisted).
def destroy
unless new_record?
connection.delete <<-end_sql, "#{self.class.name} Destroy"
DELETE FROM #{self.class.quoted_table_name}
WHERE #{connection.quote_column_name(self.class.primary_key)} = #{quoted_id}
end_sql
connection.delete(
"DELETE FROM #{self.class.quoted_table_name} " +
"WHERE #{connection.quote_column_name(self.class.primary_key)} = #{quoted_id}",
"#{self.class.name} Destroy"
)
end
freeze