Module: ActiveScaffold::ActiveRecordPermissions::ModelUserAccess::Model::ClassMethods

Defined in:
lib/active_scaffold/active_record_permissions.rb

Instance Method Summary collapse

Instance Method Details

#current_userObject

Class-level access to the current user



57
58
59
# File 'lib/active_scaffold/active_record_permissions.rb', line 57

def current_user
  ActiveRecord::Base.current_user_proc.call if ActiveRecord::Base.current_user_proc
end

#current_user_procObject

The proc to call that retrieves the current_user from the ApplicationController.



48
49
50
# File 'lib/active_scaffold/active_record_permissions.rb', line 48

def current_user_proc
  Thread.current[:current_user_proc]
end

#current_user_proc=(proc_value) ⇒ Object



52
53
54
# File 'lib/active_scaffold/active_record_permissions.rb', line 52

def current_user_proc=(proc_value)
  Thread.current[:current_user_proc] = proc_value
end