Module: AdHonorem::UserContextedConcern
- Extended by:
- ActiveSupport::Concern
- Included in:
- Badge
- Defined in:
- lib/adhonorem/concerns/user_contexted_concern.rb
Overview
:nodoc:
Instance Attribute Summary collapse
-
#user ⇒ Object
readonly
Returns the value of attribute user.
Instance Method Summary collapse
Instance Attribute Details
#user ⇒ Object (readonly)
Returns the value of attribute user.
5 6 7 |
# File 'lib/adhonorem/concerns/user_contexted_concern.rb', line 5 def user @user end |
Instance Method Details
#check_context ⇒ Object
18 19 20 |
# File 'lib/adhonorem/concerns/user_contexted_concern.rb', line 18 def check_context raise AdHonorem::NoContext, 'No context User has been set' unless @user end |
#reload_context! ⇒ Object
12 13 14 15 16 |
# File 'lib/adhonorem/concerns/user_contexted_concern.rb', line 12 def reload_context! check_context @user = AdHonorem.configuration.user_class.constantize.find(@user.id) self end |
#set_context(user) ⇒ Object
7 8 9 10 |
# File 'lib/adhonorem/concerns/user_contexted_concern.rb', line 7 def set_context(user) @user = user self end |