lib/minican/controller_additions.rb
def filter_authorized!(method, objects, user = current_user)
      object_array = Array(objects)

      object_array.select do |object|
        policy = policy_for(object)
        policy.can?(method, user)
      end
    end
def filter_authorized!(method, objects, user = current_user)
      object_array = Array(objects)

      object_array.select do |object|
        policy = policy_for(object)
        policy.can?(method, user)
      end
    end
def filter_authorized! ( method , objects , user = current_user ) object_array = Array ( objects ) object_array . select do | object | policy = policy_for ( object ) policy . can? ( method , user ) end end
Controller helper method to filter out non-authorized
 objects from the passed in array

 @param method [Symbol] method to be called on each policy
 @param objects [Array] array of objects to filter
 @param user [User] The current user object to pass
 @return (Array)

 @visibility public
Controller helper method to filter out non - authorized objects from the passed in array