Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8770273
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T17:31:43+00:00 2026-06-13T17:31:43+00:00

In our application we’ve overridden the ActiveRecord destroy method so that our records do

  • 0

In our application we’ve overridden the ActiveRecord destroy method so that our records do not get deleted (so the user can undelete). Like so:

def destroy
  self.is_deleted = true
  self.save
  freeze
end

However, this seems to have disabled the dependent destroy on our has_many relationships. In other words, if destroy is called on a parent object, the child objects of has_many do not get destroyed (they don’t get deleted, i.e, SQL ‘DELETE...‘, nor is the overridden destroy-method called).

How do I trigger the destruction of the child objects.

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T17:31:44+00:00Added an answer on June 13, 2026 at 5:31 pm

    You need to trigger the destroy callback.

    def destroy
      self.is_deleted = true
      self.save
      run_callbacks :destroy
      freeze
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Our application is failing on one specific user's computer with ERROR_NOT_ENOUGH_MEMORY (Not enough storage
Our Application has a Class that wraps Jersey REST functionality. One Method is public
Our Application deployment structure is something like this: User can download the application form
Our application can get following numbers: 0.1 0.02 0.003 etc. These values treated by
Our application is a Java-GWT application that uses Guice-Persist and Guice-Servlet extensively. We have
Our application stores records with shorter texts (strings of 100-1000 characters). It provides search
Our application has many controls that are created dynamically. For example, a navigation pane
Our application has a table which stores all transactions records of clients in one
Our application has a lot of .NET assemblies, which up until now, has not
Our application has ~10 threads doing separate tasks (no thread pools). We are not

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.