Comments (12)
@masterkain Do you have an app that you can reproduce this issue in? That would be really helpful!
from paranoia.
hi!
i'm having the same issue with rails 4.1.1. calling really_destroy! will only soft-delete the record, calling really_destroy! on an already soft-deleted record will actually delete it from the database.
i ran the test suite against rails 4.1.1 and the two tests that are checking really_destroy! are failing (along with two other tests (test_restore_with_nil_has_one_association & test_delete_behavior_for_plain_models_callbacks) that seem unrelated).
1) Failure:
ParanoiaTest#test_real_destroy_dependent_destroy [test/paranoia_test.rb:301]:
Failed refutation, no message given
3) Failure:
ParanoiaTest#test_really_destroy [test/paranoia_test.rb:294]:
Failed refutation, no message given
i looked through the code and saw the following method, which also seems to be the problem:
# As of Rails 4.1.0 +destroy!+ will no longer remove the record from the db
# unless you touch the paranoia column before.
# We need to override it here otherwise children records might be removed
# when they shouldn't
if ActiveRecord::VERSION::STRING >= "4.1"
def destroy!
destroyed? ? super : destroy || raise(ActiveRecord::RecordNotDestroyed)
end
end
so is this the expected behaviour with rails 4.1.x? do we have to touch the paranoia column before calling really_destroy! ?
from paranoia.
I get the same error when calling the regular destroy! method
from paranoia.
Yep, same here.
paranoia (~> 2.0)
Rails 4.0.4
and the method really_destroy! still soft-deletes the record.
from paranoia.
@matcouto Please upgrade your Rails version. It is currently 6 steps behind the current Rails 4.0.x "HEAD".
from paranoia.
@radar @masterkain I'm re-inventing paranoia here: https://github.com/MarkMurphy/paranoia/tree/3.0-wip
All I have left to do is re-integrate the restore methods and write the unit tests.
Major differences are:
- Less code
really_destroy!
has been replaced bydestroy!(force: true)
- It works with Rails 4.1+
- Code is much more modularized
- Has it's own configuration class
- Currently missing restore functionality
- Currently missing unit tests
from paranoia.
@MarkMurphy Why on earth are you doing that? Why not contribute back to the main repo instead of forking? If you're that keen on building it yourself then I can add you as a contributor here.
from paranoia.
@radar There's no reason it can't be turned into a pull request.
from paranoia.
Any updates on this issue? Still not working with Rails 4.1.6 in my case. Calling really_destroy!
twice also does not solve the problem.
from paranoia.
For what it's worth, I'm using paranoia 2.2.1 and Rails 4.2 and both destroy!
and really_destroy!
are working as expected. So upgrading this gem and/or Rails may solve the issue.
from paranoia.
Please try using the latest Rails + paranoia gem releases and let me know if the issue is still occurring on those. I will assume this is fixed until I see proof otherwise
from paranoia.
Hello,
I am getting the error below for inherited object:
NoMethodError: undefined method `paranoid_column' for #Class:0x00000003432aa8
Did you mean? paranoia_column
paranoia_column?
paranoia_column=
But when I include "acts_as_paranoid" to same inherited class then it really_destroy! not working. Its applying soft delete only not hard.I am using rails 5.0.2 and paranoia 2.2.0
from paranoia.
Related Issues (20)
- ArgumentError (unknown keyword: :updated_at): HOT 2
- Rails 6: after_commit on create callbacks are called after destroy on newly created records HOT 4
- Rails 7 support HOT 3
- 2.5.0 missing from Changelog HOT 3
- the files list includes entire gem as a dependency HOT 1
- Is not v2.5.1 published yet? HOT 8
- paranoia >= 2.5.1 assumes Rails constant is defined HOT 2
- New "deletion_time" does not work with sentinel_value HOT 4
- 删除
- Calling with_deleted unscopes all tables with has_many through HOT 3
- belongs_to having with_deleted scope fails to decrement counter_cache HOT 1
- It doesn't soft-delete records when updating `collection_ids` when using `has_many` with `:through`
- LoadError: cannot load such file -- rspec/expectations HOT 3
- acts_as_paranoid called more than once when using format validation HOT 2
- deleted? and paranoia_destroyed? returning different results HOT 4
- `destroy` doesn't work with the new version of Rails 7.0.6 HOT 10
- Support for rails 7.1 HOT 3
- Rails main - no superclass method `each_counter_cached_associations' HOT 1
- validates value uniqueness issue HOT 3
- Is there an option to `really_destroy_all!`? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from paranoia.