varvet / pundit

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

uninitialized constant Pundit::Authorization #731

Closed hgsgtk closed 2 years ago

hgsgtk commented 2 years ago

Hi, I changed from include Pundit to include Pundit::Authorization, but I got an error: NameError: uninitialized constant Pundit::Authorization. Have you ever get such an error before? I'd like to know a way to solve this error.

My code base is:

Gemfile

gem "pundit" 

application_controller in Rails.

class ApplicationController < ActionController::Base
  include Pundit::Authorization
Burgestrand commented 2 years ago

Hi!

Are you using latest version of Pundit? Perhaps bundler is using an old version of pundit on your system.

Latest version of pundit is 2.2.0. bundle info pundit should tell you which version bundit chose for you. You might need to bundle update pundit.

hgsgtk commented 2 years ago

@Burgestrand Sorry for delaying my response.

$ bundle info pundit                                         ‹ruby-2.7.4›
  * pundit (2.2.0)
    Summary: OO authorization for Rails
    Homepage: https://github.com/varvet/pundit
    Path: {$user}/.rvm/gems/ruby-2.7.4/gems/pundit-2.2.0

When, I restarted my application, it worked. Sorry for bothering you. Thank you for your quick response 🙇

Burgestrand commented 2 years ago

Great! I'm glad you got it to work :)