Module: CanCanDry::NoControllerCanCanAdditions
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/can_can_dry/no_controller_can_can_additions.rb
Overview
A substitute for CanCan::ControllerAdditions when no controller is present.
Class Attribute Summary collapse
-
.current_user ⇒ Object
readonly
Returns the value of attribute current_user.
Class Method Summary collapse
Instance Method Summary collapse
Class Attribute Details
.current_user ⇒ Object (readonly)
Returns the value of attribute current_user.
13 14 15 |
# File 'lib/can_can_dry/no_controller_can_can_additions.rb', line 13 def current_user @current_user end |
Class Method Details
.with_current_user(user) ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'lib/can_can_dry/no_controller_can_can_additions.rb', line 15 def with_current_user(user) old_user = @current_user begin @current_user = user yield ensure @current_user = old_user end end |
Instance Method Details
#current_user ⇒ Object
26 27 28 |
# File 'lib/can_can_dry/no_controller_can_can_additions.rb', line 26 def current_user ::CanCanDry::NoControllerCanCanAdditions.current_user end |