Module: ServiceCore::StepValidation

Extended by:
ActiveSupport::Concern
Defined in:
lib/service_core/step_validation.rb

Instance Method Summary collapse

Instance Method Details

#add_error(attribute, message, options = {}) ⇒ Object



15
16
17
18
19
# File 'lib/service_core/step_validation.rb', line 15

def add_error(attribute, message, options = {})
  value = options.empty? ? message : [message, options]
  @local_errors[attribute] ||= []
  @local_errors[attribute] << value
end

#add_error_and_validate(attribute, message, options = {}) ⇒ Object



21
22
23
24
# File 'lib/service_core/step_validation.rb', line 21

def add_error_and_validate(attribute, message, options = {})
  add_error(attribute, message, options)
  valid?
end