Module: CsvRowModel::Validators::ValidateAttributes

Extended by:
ActiveSupport::Concern
Included in:
Import::File::Validations, Model
Defined in:
lib/csv_row_model/validators/validate_attributes.rb

Overview

adds validates_attributes method to validate the attributes of an attributes

Defined Under Namespace

Classes: AttributeValidator

Class Method Summary collapse

Class Method Details

.validate_attributes(*attributes) ⇒ Object (protected)

Adds validation check to add errors any attribute of attributes passed is truthy and invalid. Inspired by: https://github.com/rails/rails/blob/2bb0abbec0e4abe843131f188129a1189b1bf714/activerecord/lib/active_record/validations/associated.rb#L46

Parameters:

  • attributes (Array<Symbol>)

    array of attributes to validate their attributes



21
22
23
# File 'lib/csv_row_model/validators/validate_attributes.rb', line 21

def validate_attributes(*attributes)
  validates_with AttributeValidator, { attributes: attributes }
end