Sha256: 46b4a88878386427f92e83215600a7250a5faa3329aff4393ae987d20aa64251
Contents?: true
Size: 811 Bytes
Versions: 1
Compression:
Stored size: 811 Bytes
Contents
require 'active_support/concern' module Fume module Cancan module ControllerExtensions extend ActiveSupport::Concern module ClassMethods def authorize_object(*args) options = args.extract_options! object = args.shift || options[:object] filter_options = options.slice(:only, :except) before_filter(filter_options || {}) do |controller| controller.send :authorize_object!, object, options end end end protected def authorize_object!(object, options = {}) action = (options[:action] || params[:action]).to_sym authorize! action, object end end end end if defined? ActionController::Base ActionController::Base.send :include, ::Fume::Cancan::ControllerExtensions end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
fume-cancan-0.0.4 | lib/fume/cancan/controller_extensions.rb |