Class: ActiveInteractor::Context::Base
- Inherits:
- 
      Object
      
        - Object
- ActiveInteractor::Context::Base
 
- Includes:
- AttributeAssignment, AttributeRegistration, HasActiveModelErrors, Type::HasTypes, ActiveModel::Validations
- Defined in:
- lib/active_interactor/context/base.rb
Constant Summary
Constants included from Type::HasTypes
Instance Attribute Summary collapse
- 
  
    
      #errors  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    Returns the value of attribute errors. 
Instance Method Summary collapse
- 
  
    
      #initialize(attributes = {})  ⇒ Base 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    A new instance of Base. 
- #validate! ⇒ Object
Methods included from AttributeAssignment
Methods included from HasActiveModelErrors
#read_attribute_for_validation
Constructor Details
#initialize(attributes = {}) ⇒ Base
Returns a new instance of Base.
| 14 15 16 17 18 19 20 21 | # File 'lib/active_interactor/context/base.rb', line 14 def initialize(attributes = {}) @errors = ActiveModel::Errors.new(self) attribute_set.attributes.each do |attribute| next unless attributes.with_indifferent_access.key?(attribute.name) assign_attribute_value(attribute.name, attributes.with_indifferent_access[attribute.name]) end end | 
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class ActiveInteractor::Context::AttributeAssignment
Instance Attribute Details
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
| 12 13 14 | # File 'lib/active_interactor/context/base.rb', line 12 def errors @errors end | 
Instance Method Details
#validate! ⇒ Object
| 23 24 25 26 27 28 | # File 'lib/active_interactor/context/base.rb', line 23 def validate! attribute_set.attributes.each do |attribute| attribute.validate! attribute..each { || errors.add(attribute.name, ) } end end |