Class: ActiveLayer::Validations::ObjectValidator

Inherits:
ActiveModel::Validator
  • Object
show all
Defined in:
lib/active_layer/validations/object_validator.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#active_layer_validatorObject

Returns the value of attribute active_layer_validator.



8
9
10
# File 'lib/active_layer/validations/object_validator.rb', line 8

def active_layer_validator
  @active_layer_validator
end

Instance Method Details

#validate(record) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/active_layer/validations/object_validator.rb', line 10

def validate(record)
  # need to save the original errors because they get wiped during validation
  record.keep_errors do
    active_layer_validator.active_layer_object = record
    active_layer_validator.valid?
  end
end