Module: Authpds::Controllers::AuthpdsController::CoreAttributes
- Defined in:
- lib/authpds/controllers/authpds_controller/core_attributes.rb
Class Method Summary collapse
-
.included(klass) ⇒ Object
Set helper methods when this module is included.
Instance Method Summary collapse
-
#current_user ⇒ Object
Get the current User if there is a UserSession.
-
#current_user_session ⇒ Object
Get the current UserSession if it exists.
Class Method Details
.included(klass) ⇒ Object
Set helper methods when this module is included.
6 7 8 9 10 |
# File 'lib/authpds/controllers/authpds_controller/core_attributes.rb', line 6 def self.included(klass) klass.class_eval do helper_method :current_user_session, :current_user end end |
Instance Method Details
#current_user ⇒ Object
Get the current User if there is a UserSession
18 19 20 |
# File 'lib/authpds/controllers/authpds_controller/core_attributes.rb', line 18 def current_user @current_user ||= current_user_session.record unless current_user_session.nil? end |
#current_user_session ⇒ Object
Get the current UserSession if it exists
13 14 15 |
# File 'lib/authpds/controllers/authpds_controller/core_attributes.rb', line 13 def current_user_session @current_user_session ||= UserSession.find end |