Class: RestMyCase::Validator
- Extended by:
- AccusationAttorneys::HelperMethods, ClassMethods
- Defined in:
- lib/rest_my_case/validator.rb
Defined Under Namespace
Modules: ClassMethods
Instance Attribute Summary
Attributes included from ClassMethods
Attributes inherited from Base
Attributes included from Config::Base
#parent_dependencies_first, #silence_dependencies_abort
Instance Method Summary collapse
Methods included from ClassMethods
Methods included from AccusationAttorneys::HelperMethods
_merge_attributes, validates_format_of, validates_length_of, validates_numericality_of, validates_presence_of
Methods inherited from Base
#abort, #abort!, context_accessor, context_reader, context_writer, dependencies, depends, #error, #error!, #final, #initialize, #invoke, #invoke!, perform, required_context, required_context_schema, #rollback, #setup, #skip, #skip!, trial_court, #validate_context, #validate_context!
Constructor Details
This class inherits a constructor from RestMyCase::Base
Instance Method Details
#parent_target ⇒ Object
67 68 69 70 |
# File 'lib/rest_my_case/validator.rb', line 67 def parent_target @parent_target ||= [:in] ? get_target([:in]) : nil end |
#perform ⇒ Object
86 87 88 89 90 91 92 93 94 |
# File 'lib/rest_my_case/validator.rb', line 86 def perform targets = [*target] return if Helpers.blank?(targets) || all_validations_green?(targets) parent_target.errors.add([:name], :invalid) if parent_target error('unprocessable_entity') end |
#target ⇒ Object
72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/rest_my_case/validator.rb', line 72 def target return nil if [:name].nil? target_content = get_target([:name]) if parent_target extend_errors_if_necessary(parent_target) target_content ||= parent_target.send([:name]) end target_content end |
#target_options ⇒ Object
63 64 65 |
# File 'lib/rest_my_case/validator.rb', line 63 def self.class. || {} end |