module Mongoid::EncryptedField

Public Instance Methods

encrypted() click to toggle source
# File lib/mongoid-encrypted-fields/fields/encrypted_field.rb, line 8
def encrypted
  if frozen?
    @encrypted ||= self.class.encrypt(raw_value)
  else
    # We are mutable - need to encrypt whenever asked
    self.class.encrypt(raw_value)
  end
end
mongoize() click to toggle source

Converts an object of this instance into a database friendly value.

# File lib/mongoid-encrypted-fields/fields/encrypted_field.rb, line 18
def mongoize
  encrypted
end
raw_value() click to toggle source

Provide string to be encrypted and stored in Mongo DB

# File lib/mongoid-encrypted-fields/fields/encrypted_field.rb, line 23
def raw_value
  to_s
end