Sha256: b931c94f0800808aebe13d9bc59eb42c6b38cf98be1de10ee070aa806988f0a1
Contents?: true
Size: 544 Bytes
Versions: 4
Compression:
Stored size: 544 Bytes
Contents
# Add an ActiveModel Validator # # Example: # class MyModel < ActiveRecord::Base # validates :encrypted_ssn, symmetric_encryption: true # end # # m = MyModel.new # m.valid? # # => false # m.encrypted_ssn = SymmetricEncryption.encrypt('123456789') # m.valid? # # => true class SymmetricEncryptionValidator < ActiveModel::EachValidator def validate_each(record, attribute, value) record.errors.add(attribute, "must be a value encrypted using SymmetricEncryption.encrypt") unless SymmetricEncryption.encrypted?(value) end end
Version data entries
4 entries across 4 versions & 1 rubygems