Module: ValidationGroup::ActiveRecord::Errors

Defined in:
lib/validation_group.rb

Overview

included in ActiveModel::Errors

Instance Method Summary collapse

Instance Method Details

#add(attribute, type = :invalid, **options) ⇒ Object



91
92
93
94
95
# File 'lib/validation_group.rb', line 91

def add(attribute, type = :invalid, **options)
  # jeffp: setting @current_validation_fields and use of should_validate? optimizes code
  add_error = @base.respond_to?(:should_validate?) ? @base.should_validate?(attribute.to_sym) : true
  super if add_error
end