module Protector::CanCan::Resource
Public Instance Methods
load_collection_with_protector()
click to toggle source
# File lib/protector/cancan/resource.rb, line 20 def load_collection_with_protector resource = resource_base if resource_protectable? resource resource else load_collection_without_protector end end
load_collection_with_protector?()
click to toggle source
# File lib/protector/cancan/resource.rb, line 30 def load_collection_with_protector? if resource_protectable? resource_base true else load_collection_without_protector? end end
resource_base_with_protector()
click to toggle source
# File lib/protector/cancan/resource.rb, line 10 def resource_base_with_protector resource = resource_base_without_protector if resource_protectable? resource resource.restrict!(current_ability.protector_subject) else resource end end
Private Instance Methods
resource_protectable?(resource)
click to toggle source
# File lib/protector/cancan/resource.rb, line 40 def resource_protectable?(resource) resource.respond_to?(:restrict!) && current_ability.protector_subject? end