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
#context, #dependent_use_case, #options
Attributes included from Config::Base
#parent_dependencies_first, #silence_dependencies_abort
Instance Method Summary collapse
Methods included from ClassMethods
trial_court, validate, validates_with
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, #rollback, #setup, #skip, #skip!, trial_court
Constructor Details
This class inherits a constructor from RestMyCase::Base
Instance Method Details
#parent_target ⇒ Object
70 71 72 73 |
# File 'lib/rest_my_case/validator.rb', line 70 def parent_target @parent_target ||= [:in] ? get_target([:in]) : nil end |
#perform ⇒ Object
89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/rest_my_case/validator.rb', line 89 def perform targets = [*target] return if Helpers.blank?(targets) || all_validations_green?(targets) if parent_target parent_target.errors.add([:name], :invalid) end error('unprocessable_entity') end |
#target ⇒ Object
75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/rest_my_case/validator.rb', line 75 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
66 67 68 |
# File 'lib/rest_my_case/validator.rb', line 66 def self.class. || {} end |