User submissions are the sole responsibility of contributors, with TuteeHUB disclaiming liability for accuracy, copyrights, or consequences of use; content is for informational purposes only and not professional advice.
everytime I submit a form here (that I scaffolded) localhost:3000/syllabus_requests/new
The rescue_from Pundit::NotAuthorizedError, with: :user_not_authorized from my ApplicationController.rb file gets raised and I'm not sure why because in the policy class I have a create? method and it returns true
classSyllabusRequestPolicy<ApplicationPolicy
attr_reader :current_user,:model
def initialize(current_user, model)@current_user= current_user ||User.new@model= model #this is the syllabus_request record from the syllabus_requests table as a rails model objectenddefindex?@current_user.role =="admin"enddef show?@current_user.role =="admin"enddef create?trueenddef edit?@current_user.role =="admin"enddefupdate?@current_user.role =="admin"enddef destroy?@current_user.role =="admin"endend
No matter what stage you're at in your education or career, TuteeHUB will help you reach the next level that
you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice
sessions to improve your knowledge and scores.
manpreet
Best Answer
3 years ago
everytime I submit a form here (that I scaffolded) localhost:3000/syllabus_requests/new
The rescue_from Pundit::NotAuthorizedError, with: :user_not_authorized from my ApplicationController.rb file gets raised and I'm not sure why because in the policy class I have a create? method and it returns true
i'm using ruby '2.3.1' gem 'rails', '~> 5.0.0', '>= 5.0.0.1' gem 'pundit', '~> 1.1'
I have a policy
I have a controller