Skip to content

ActiveSupport::Deprecation#warn no longer works on Rails 7.2 #573

Description

@caius

If you invoke Model.restore(instance) then paranoia finds the id from the instances for you and issues a deprecation warning at https://github.com/rubysherpas/paranoia/blob/core/lib/paranoia.rb#L50-L54

In Rails 7 they've added specific ActiveSupport::Deprecator instances to be used instead of a generic .warn method, and by Rails 7.2 the ActiveSupport::Deprecation.warn method has been undefined so we get a NoMethodError when passing a record rather than the code working and a deprecation warning being emitted.

We should update the behaviour in paranoia to work out if we're on a new enough rails (probably check for presence of ActiveSupport::Deprecation.method(:warn)?) to use the Deprecator instances and create one for the Paranoia gem rather than using the generic .warn across the app in the earlier Railses.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions