Sha256: dc72e7a4abf2b68e04c0803230b9dcf789e3e5ab12cc359fbfcc69538251ccc4
Contents?: true
Size: 917 Bytes
Versions: 7
Compression:
Stored size: 917 Bytes
Contents
module Fume module Cancan def self.try_enable if defined? ::CanCan ActionController::Base.send :include, ControllerExtensions end end module ControllerExtensions extend ActiveSupport::Concern module ClassMethods def authorize_object(options = {}) filter_options = options.slice(:only, :except) if options.is_a?(Hash) before_filter(filter_options || {}) do |controller| controller.send :authorize_object!, options end end end module InstanceMethods protected def authorize_object!(options) action = params[:action].to_sym case options when Hash authorize! action, options[:object] else authorize! action, options end end end end end end
Version data entries
7 entries across 7 versions & 1 rubygems