lib/symmetric_encryption.rb in symmetric-encryption-4.1.0 vs lib/symmetric_encryption.rb in symmetric-encryption-4.1.1
- old
+ new
@@ -26,37 +26,36 @@
autoload :ReEncryptFiles, 'symmetric_encryption/utils/re_encrypt_files'
end
end
# @formatter:on
-# Add support for other libraries only if they have already been loaded
-
+# Add extensions. Gems are no longer order dependent.
begin
- require 'rails/railtie'
- require 'symmetric_encryption/railtie' if defined?(Rails)
+ require 'rails'
+ require 'symmetric_encryption/railtie'
rescue LoadError
end
begin
require 'active_record'
- if defined?(ActiveRecord::Base) && !defined?(AttrEncrypted::Version)
- require 'symmetric_encryption/extensions/active_record/base'
- end
+ require 'symmetric_encryption/extensions/active_record/base'
rescue LoadError
end
begin
require 'active_model'
- require 'symmetric_encryption/railties/symmetric_encryption_validator' if defined?(ActiveModel)
+ require 'symmetric_encryption/railties/symmetric_encryption_validator'
rescue LoadError
end
begin
require 'mongoid'
- require 'symmetric_encryption/extensions/mongoid/encrypted' if defined?(Mongoid)
+ require 'symmetric_encryption/extensions/mongoid/encrypted'
rescue LoadError
end
-if defined?(MongoMapper)
- warn 'MongoMapper support is deprecated. Upgrade to Mongoid.'
+begin
+ require 'mongo_mapper'
+ warn 'MongoMapper support is deprecated. Please upgrade to Mongoid.'
require 'symmetric_encryption/extensions/mongo_mapper/plugins/encrypted_key'
+rescue LoadError
end