lib/symmetric_encryption/generator.rb in symmetric-encryption-3.7.2 vs lib/symmetric_encryption/generator.rb in symmetric-encryption-3.8.0
- old
+ new
@@ -22,11 +22,11 @@
mod.module_eval(<<-EOS, __FILE__, __LINE__ + 1)
# Set the un-encrypted field
# Also updates the encrypted field with the encrypted value
# Freeze the decrypted field value so that it is not modified directly
def #{decrypted_name}=(value)
- v = SymmetricEncryption::coerce(value, :#{type})
+ v = SymmetricEncryption::Coerce.coerce(value, :#{type})
self.#{encrypted_name} = @stored_#{encrypted_name} = ::SymmetricEncryption.encrypt(v,#{random_iv},#{compress},:#{type})
@#{decrypted_name} = v.freeze
end
# Returns the decrypted value for the encrypted field
@@ -38,9 +38,13 @@
@stored_#{encrypted_name} = self.#{encrypted_name}
end
@#{decrypted_name}
end
+ # Map changes to encrypted value to unencrypted equivalent
+ def #{decrypted_name}_changed?
+ #{encrypted_name}_changed?
+ end
EOS
end
end
end