You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Dec 12, 2021. It is now read-only.
I'm trying to authorize a controller that does not have a model. When I try to load the controller "/calendar/patient_calendar", I get the error:
undefined method `cannot?' for CalendarController:Class
Here's my controller:
class CalendarController < ApplicationController
layout "users"
before_filter(:only => :patient_calendar) { unauthorized! if cannot? :read, :patient_calendar }
def patient_calendar
end
def public_calendar
end
end
And here are my abilities:
class Ability
include CanCan::Ability
def initialize(user)
if user.nil?
can :create, [Message, Gwapp]
can :read, :public_calendar
elsif user.user_type == "admin"
can :manage, :all
end
end
end
Any idea what's going on?
The text was updated successfully, but these errors were encountered:
I appear to be having the same issue. I notice that if I move the unauthorized! call into the individual methods, there is no further error around undefined method `cannot?' for ...
I'm trying to authorize a controller that does not have a model. When I try to load the controller "/calendar/patient_calendar", I get the error:
undefined method `cannot?' for CalendarController:Class
Here's my controller:
And here are my abilities:
Any idea what's going on?
The text was updated successfully, but these errors were encountered: