Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Really destroy acts_as_paranoid objects

I have a problem with with acts_as_paranoid objects. Now i want to really destroy the object but i cant find an easy way.

I dont like to use hard coded SQL for this problem.

Somebody knows a quick nice solution?

UPDATE

I came up with the following solution. I dont like this that much but it works....

# Use this function wisely
def really_destroy
  ActiveRecord::Base.connection.execute("DELETE FROM user_widgets WHERE id = #{self.id}")
end
like image 620
Michael Koper Avatar asked Jan 20 '23 00:01

Michael Koper


1 Answers

Add a bang to the destroy method.

def really_destroy
  self.destroy!
end
like image 69
Douglas F Shearer Avatar answered Jan 26 '23 00:01

Douglas F Shearer