Sha256: cc7f92d46f205fceaa51ec5cccc04d32beb9820a5fe1ec8822f2223bdd3ab797
Contents?: true
Size: 547 Bytes
Versions: 25
Compression:
Stored size: 547 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
25 entries across 25 versions & 1 rubygems