Sha256: d23b36fefa40c3bfda2696ac98721a6d4dcec26f8dccd21041c47ceea5e0f7b7

Contents?: true

Size: 394 Bytes

Versions: 5

Compression:

Stored size: 394 Bytes

Contents

module Blacksand

  class Cancancan
    def initialize(controller)
      @controller = controller
      @controller.extend ControllerExtension
    end

    def authorized?(action, object)
      @controller.current_ability.can?(action, object)
    end

    module ControllerExtension
      def current_ability
        @current_ability ||= ::Ability.new(_current_user)
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
blacksand-2.5.0 lib/blacksand/cancancan.rb
blacksand-2.4.1 lib/blacksand/cancancan.rb
blacksand-2.4.0 lib/blacksand/cancancan.rb
blacksand-2.3.0 lib/blacksand/cancancan.rb
blacksand-2.2.2.1 lib/blacksand/cancancan.rb