Module: CurrentUser
- Defined in:
- lib/current_user.rb,
lib/current_user/engine.rb,
lib/current_user/version.rb,
lib/current_user/constants.rb,
lib/current_user/controller/helpers.rb,
app/helpers/current_user/application_helper.rb,
lib/generators/current_user/install_generator.rb,
app/controllers/current_user/sessions_controller.rb,
app/controllers/current_user/application_controller.rb
Defined Under Namespace
Modules: ApplicationHelper, Controller, Generators
Classes: ApplicationController, Engine, SessionsController
Constant Summary
collapse
- VERSION =
"0.2.1"
- USER_SESSION_KEY =
'__current_user_session_key__'
- STORED_LOCATION_KEY =
'__current_user_stored_location_key__'
Class Method Summary
collapse
Class Method Details
.identifier_for(user) ⇒ Object
14
15
16
17
18
19
20
21
22
|
# File 'lib/current_user.rb', line 14
def identifier_for(user)
identifier = ::CurrentUser.identifier
if identifier.respond_to? :call
identifier.call user
else
user.send identifier
end
end
|
.read_authentication_key ⇒ Object
25
26
27
28
29
30
|
# File 'lib/current_user.rb', line 25
def read_authentication_key
key_file_path = File.expand_path 'config/current_user/key', Rails.root
if File.exist? key_file_path
File.open(key_file_path) { |f| f.readline }
end
end
|
.setup {|_self| ... } ⇒ Object
6
7
8
|
# File 'lib/current_user.rb', line 6
def self.setup
yield self
end
|