1

I get the following error whenever I try to create a new user after I installed pundit within my project. It seems as if it can't find pundit, even though I installed it and included the gem and ran bundle install.

app_1  | ActionController::RoutingError (uninitialized constant ApplicationController::Pundit):
app_1  |   
app_1  | app/controllers/application_controller.rb:3:in `<class:ApplicationController>'
app_1  | app/controllers/application_controller.rb:1:in `<top (required)>'
app_1  | app/controllers/v1/users_controller.rb:1:in `<top (required)>'

My ApplicationController.rb

class ApplicationController < ActionController::API
  before_action :authenticate_user!
  include Pundit

  after_action :verify_authorized, except: :index, unless: :skip_pundit?
  after_action :verify_policy_scoped, only: :index, unless: :skip_pundit?

  private

  def skip_pundit?
    devise_controller? || params[:controller] =~ /(^(rails_)?admin)|(^pages$)/
  end
end
razvanusc
  • 169
  • 3
  • 15

1 Answers1

0

Restarting rails server worked for me

Dev11
  • 1
  • 1