lib/symmetric_encryption.rb in symmetric-encryption-4.2.1 vs lib/symmetric_encryption.rb in symmetric-encryption-4.3.0

- old
+ new

@@ -8,13 +8,17 @@ end begin require 'active_support' ActiveSupport.on_load(:active_record) do - require 'symmetric_encryption/railties/attr_encrypted' + require 'symmetric_encryption/active_record/attr_encrypted' require 'symmetric_encryption/railties/symmetric_encryption_validator' - ActiveRecord::Base.include(SymmetricEncryption::Railties::AttrEncrypted) + if ActiveRecord.version >= Gem::Version.new('5.0.0') + ActiveRecord::Type.register(:encrypted, SymmetricEncryption::ActiveRecord::EncryptedAttribute) + end + + ActiveRecord::Base.include(SymmetricEncryption::ActiveRecord::AttrEncrypted) end ActiveSupport.on_load(:mongoid) do require 'symmetric_encryption/railties/mongoid_encrypted' require 'symmetric_encryption/railties/symmetric_encryption_validator'