Sha256: 408a188fefae9ff2cf79910e8909460be7ab41447f782a727c39fd7f7ac426d8
Contents?: true
Size: 516 Bytes
Versions: 13
Compression:
Stored size: 516 Bytes
Contents
class BazaModels::Validators::ConfirmationValidator < BazaModels::Validators::BaseValidator def validate(model, value) confirmation_attribute_name = "#{attribute_name}_confirmation" confirmation_value = model.__send__(confirmation_attribute_name) if value && !confirmation_value model.errors.add(attribute_name, "hasn't been confirmed") end model.errors.add(attribute_name, "was not the same as the confirmation") if value && confirmation_value && confirmation_value != value end end
Version data entries
13 entries across 13 versions & 1 rubygems