rubysherpas / paranoia

acts_as_paranoid for Rails 5, 6 and 7
Other
2.89k stars 529 forks source link

before_restore raises an exception when trying to append to nil? #488

Closed lubekpl closed 4 years ago

lubekpl commented 4 years ago

:wave:

Trying to update rails from 5.0.7.2 to 5.1.7 and running into an issue, namely, calling paranoia ends up raising an exception

concern

require "paranoia"

module SoftDeletable
  extend ActiveSupport::Concern

  included do
    acts_as_paranoid without_default_scope: true
  end
end

model

class User < ApplicationRecord
  include SoftDeletable
end 
be rspec spec/models/user_spec.rb
Skipping generating coverage report, CI env var not defined

An error occurred while loading ./spec/models/user_spec.rb.
Failure/Error: include SoftDeletable

NoMethodError:
  undefined method `append' for nil:NilClass

exception while pryed inside paranoia itself

[test] User:0> before_restore {
[test] User:0>   self.class.notify_observers(:before_restore, self) if self.class.respond_to?(:notify_observers)
[test] User:0> }
NoMethodError: undefined method `append' for nil:NilClass

Calling before_restore with an empty block results in the same error

I can't seem to get what the problem here is, can you guys offer any insight?