Sha256: b3047214f9d36b7f260b8e8a64114188f768dabd6361abc0ddadeda03e97beb8
Contents?: true
Size: 630 Bytes
Versions: 10
Compression:
Stored size: 630 Bytes
Contents
# frozen_string_literal: true module CanCanDry # A substitute for CanCan::ControllerAdditions when no controller is present. module NoControllerCanCanAdditions extend ::ActiveSupport::Concern included do include ::CanCan::ControllerAdditions end class << self attr_reader :current_user def with_current_user(user) old_user = @current_user begin @current_user = user yield ensure @current_user = old_user end end end def current_user ::CanCanDry::NoControllerCanCanAdditions.current_user end end end
Version data entries
10 entries across 10 versions & 1 rubygems