Class: MrMime::Impersonation
- Inherits:
-
Object
- Object
- MrMime::Impersonation
- Extended by:
- ActiveModel::Naming
- Includes:
- ActiveModel::Conversion, ActiveModel::Validations
- Defined in:
- app/models/mr_mime/impersonation.rb
Instance Attribute Summary collapse
-
#return_to ⇒ Object
readonly
Returns the value of attribute return_to.
Instance Method Summary collapse
- #error_messages ⇒ Object
- #impersonated ⇒ Object
- #impersonator ⇒ Object
-
#initialize(options = {}) ⇒ Impersonation
constructor
A new instance of Impersonation.
- #revert ⇒ Object
- #save ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Impersonation
Returns a new instance of Impersonation.
17 18 19 20 21 22 |
# File 'app/models/mr_mime/impersonation.rb', line 17 def initialize( = {}) @adapter = adapter_class.new(.fetch(:context)) @store = MrMime::Store.new([:store] || {}) @params = [:params] || {} @return_to = store.get(:return_to) end |
Instance Attribute Details
#return_to ⇒ Object (readonly)
Returns the value of attribute return_to.
15 16 17 |
# File 'app/models/mr_mime/impersonation.rb', line 15 def return_to @return_to end |
Instance Method Details
#error_messages ⇒ Object
43 44 45 |
# File 'app/models/mr_mime/impersonation.rb', line 43 def errors..join(', ') end |
#impersonated ⇒ Object
39 40 41 |
# File 'app/models/mr_mime/impersonation.rb', line 39 def impersonated @impersonated ||= find_user(params[:impersonated_id]) end |
#impersonator ⇒ Object
35 36 37 |
# File 'app/models/mr_mime/impersonation.rb', line 35 def impersonator @impersonator ||= find_user(params[:impersonator_id]) end |
#revert ⇒ Object
31 32 33 |
# File 'app/models/mr_mime/impersonation.rb', line 31 def revert revert_user_keys end |
#save ⇒ Object
24 25 26 27 28 29 |
# File 'app/models/mr_mime/impersonation.rb', line 24 def save if valid? set_user_keys true end end |