Here is the full error:
Can't verify CSRF token authenticity
User Load (0.3ms) SELECT `users`.* FROM `users` WHERE `users`.`id` = 5 ORDER BY `users`.`id` ASC LIMIT 1
(0.1ms) BEGIN
(0.2ms) COMMIT
Completed 500 Internal Server Error in 22ms
NoMethodError - undefined method `has_role?' for nil:NilClass:
app/controllers/application_controller.rb:8:in `authenticate_admin_user!'
I can verify that I was logged in at the time with an admin user.
Here is the controller that is triggering the error:
class ApplicationController < ActionController::Base
def authenticate_admin_user!
unless current_user.has_role? :admin
flash[:alert] = "This area is restricted to administrators only."
redirect_to main_app.root_path
end
end