Giter Site home page Giter Site logo

Comments (12)

radar avatar radar commented on September 17, 2024

@masterkain Do you have an app that you can reproduce this issue in? That would be really helpful!

from paranoia.

srecnig avatar srecnig commented on September 17, 2024

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.

MarkMurphy avatar MarkMurphy commented on September 17, 2024

I get the same error when calling the regular destroy! method

from paranoia.

matcouto avatar matcouto commented on September 17, 2024

Yep, same here.
paranoia (~> 2.0)
Rails 4.0.4
and the method really_destroy! still soft-deletes the record.

from paranoia.

radar avatar radar commented on September 17, 2024

@matcouto Please upgrade your Rails version. It is currently 6 steps behind the current Rails 4.0.x "HEAD".

from paranoia.

MarkMurphy avatar MarkMurphy commented on September 17, 2024

@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 by destroy!(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.

radar avatar radar commented on September 17, 2024

@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.

MarkMurphy avatar MarkMurphy commented on September 17, 2024

@radar There's no reason it can't be turned into a pull request.

from paranoia.

zwippie avatar zwippie commented on September 17, 2024

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.

stevegrossi avatar stevegrossi commented on September 17, 2024

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.

radar avatar radar commented on September 17, 2024

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.

sumit-rvtech avatar sumit-rvtech commented on September 17, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.