varvet / pundit

Minimal authorization through OO design and pure Ruby classes
MIT License
8.21k stars 624 forks source link

uninitialized constant Pundit::Authorization #798

Closed albertski closed 4 months ago

albertski commented 4 months ago

Below is a simplified version of a concern I use in my Controllers.

module One
  module Two
    module PunditAuthorization
      extend ActiveSupport::Concern
      include Pundit::Authorization
    end
  end
end

When I upgraded to Rails 7, I got the following error:

my-engine/controllers/concerns/one/two/pundit_authorization.rb:6:in `<module:PunditAuthorization>': uninitialized constant One::Two::PunditAuthorization::Pundit (NameError)

      include Pundit::Authorization
              ^^^^^^^^^^^^^^^

The issue disappears if I use include Pundit instead of include Pundit::Authorization. Should we be using include Pundit::Authorization in Rails 7?

Burgestrand commented 4 months ago

No, include Pundit is deprecated and will be removed in a future release.

With the limited information provided my first guess is that you might be using an old version of Pundit.truby

Moving this to discussions.