I have two models articles and bookmarks. Both are defined as acts_as_paranoid objects. Relationship between them is
article.rb
has_many :bookmarks, foreign_key: 'article_doi', primary_key: 'doi', dependent: :destroy
bookmark.rb
belongs_to :article, foreign_key: 'article_doi', primary_key: 'doi'
Now I want to really remove a bookmark object and also remove the dependent bookmarks objects.
@article.destroy!
and checked
@article.bookmarks
did not remove the article or its bookmarks. How can I really remove them from the database and its associated bookmarks?
To permanently destroy from database you can use really_destroy!
method.
Try using @article.really_destroy!
https://github.com/rubysherpas/paranoia#usage
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With