Reputation: 183
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?
Upvotes: 5
Views: 7643
Reputation: 3231
To permanently destroy from database you can use really_destroy!
method.
Try using @article.really_destroy!
https://github.com/rubysherpas/paranoia#usage
Upvotes: 8