lib/kms_encrypted/model.rb in kms_encrypted-1.5.1 vs lib/kms_encrypted/model.rb in kms_encrypted-1.6.0
- old
+ new
@@ -79,10 +79,10 @@
KmsEncrypted::Database.new(self, key_method).decrypt(encrypted_key)
else
key = SecureRandom.random_bytes(32)
if eager_encrypt == :fetch_id
- raise ArgumentError, ":fetch_id only works with Postgres" unless self.class.connection.adapter_name =~ /postg/i
+ raise ArgumentError, ":fetch_id only works with Postgres" unless self.class.connection.adapter_name.match?(/postg/i)
self.id ||= self.class.connection.execute("select nextval('#{self.class.sequence_name}')").first["nextval"]
end
if eager_encrypt == true || ([:try, :fetch_id].include?(eager_encrypt) && id)
encrypted_key = KmsEncrypted::Database.new(self, key_method).encrypt(key)