Skip to content

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

@caius

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.

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