Module: Canator

Defined in:
lib/canator.rb,
lib/canator/engine.rb,
lib/canator/version.rb

Defined Under Namespace

Modules: ControllerClassMethods, ControllerInstanceMethods, ModelClassMethods, ModelInstanceMethods Classes: Engine

Constant Summary collapse

VERSION =
"0.1.5"

Class Method Summary collapse

Class Method Details

.current_userObject

Controller-independent method for retrieving the current user. Needed for model security where the current controller is not available.



7
8
9
# File 'lib/canator.rb', line 7

def self.current_user
  Thread.current["current_user"] || nil
end

.current_user=(user) ⇒ Object

Controller-independent method for setting the current user.



12
13
14
# File 'lib/canator.rb', line 12

def self.current_user=(user)
  Thread.current["current_user"] = user
end