lib/symmetric_encryption/railties/mongoid_encrypted.rb in symmetric-encryption-4.3.1 vs lib/symmetric_encryption/railties/mongoid_encrypted.rb in symmetric-encryption-4.3.2
- old
+ new
@@ -1,6 +1,6 @@
-require 'mongoid'
+require "mongoid"
# Add :encrypted option for Mongoid models
#
# Example:
#
# require 'mongoid'
@@ -93,11 +93,11 @@
options = options.is_a?(Hash) ? options.dup : {}
encrypted_field_name = field.name
# Support overriding the name of the decrypted attribute
decrypted_field_name = options.delete(:decrypt_as)
- if decrypted_field_name.nil? && encrypted_field_name.to_s.start_with?('encrypted_')
- decrypted_field_name = encrypted_field_name.to_s['encrypted_'.length..-1]
+ if decrypted_field_name.nil? && encrypted_field_name.to_s.start_with?("encrypted_")
+ decrypted_field_name = encrypted_field_name.to_s["encrypted_".length..-1]
end
if decrypted_field_name.nil?
raise(ArgumentError, "SymmetricEncryption for Mongoid. Encryption enabled for field #{encrypted_field_name}. It must either start with 'encrypted_' or the option :decrypt_as must be supplied")
end