Sha256: b17bdfa77bc99d523ce76c8039a7f8304c70f4ad742b4f7b2c0d4800c1cbd136
Contents?: true
Size: 922 Bytes
Versions: 7
Compression:
Stored size: 922 Bytes
Contents
module Fume module Cancan def self.try_enable(app) 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