# Override ActiveRecord:Base.destroy

**URL:** <https://www.ruby-forum.com/t/override-activerecord-base-destroy/173246>\
**Category:** Rails\
**Created:** [August 5, 2009, 4:25pm UTC](https://www.ruby-forum.com/t/override-activerecord-base-destroy/173246 "2009-08-05T16:25:35Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![DAddYE](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/2bfe46/32.png) [@DAddYE](https://www.ruby-forum.com/u/DAddYE)\
**Post date:** [August 5, 2009, 4:25pm UTC](https://www.ruby-forum.com/t/override-activerecord-base-destroy/173246/1 "2009-08-05T16:25:35Z")

</div>

Dear rails developpers Im build a new adapter (mongo)

I need to override this:

```
  # Deletes the record in the database and freezes this instance

```

to reflect that no changes should  
# be made (since they can’t be persisted).  
def destroy  
unless new\_record?  
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
  end

```

I tried (As I see on the web) to override it with  
destroy\_without\_callbacks, but didn’t work. Any suggestion?

Thanks!
