lib/authority/controller.rb in authority-2.4.2 vs lib/authority/controller.rb in authority-2.4.3
- old
+ new
@@ -12,11 +12,11 @@
end
end
included do
rescue_from(Authority::SecurityViolation, :with => Authority::Controller.security_violation_callback)
- class_attribute :authority_resource, instance_reader: false
+ class_attribute :authority_resource, :instance_reader => false
end
module ClassMethods
# Sets up before_filter to ensure user is allowed to perform a given controller action
@@ -87,13 +87,13 @@
private
# The `before_filter` that will be setup to run when the class method
# `authorize_actions_for` is called
def run_authorization_check
- authorize_action_for authority_resource
+ authorize_action_for instance_authority_resource
end
- def authority_resource
+ def instance_authority_resource
return self.class.authority_resource if self.class.authority_resource.is_a?(Class)
send(self.class.authority_resource)
rescue NoMethodError => e
raise MissingResource.new(
"Trying to authorize actions for '#{self.class.authority_resource}', but can't. \