Class: Mongoid::Fields::Encrypted
| Relationships & Source Files | |
| Super Chains via Extension / Inclusion / Inheritance | |
| 
         Class Chain: 
        
          self,
           
      Standard,
          Forwardable
         | 
    |
| 
         Instance Chain: 
        
          self,
           
      Standard
         | 
    |
| Inherits: | 
        Mongoid::Fields::Standard
        
  | 
    
| Defined in: | lib/mongoid/fields/encrypted.rb | 
Overview
Represents a field that should be encrypted.
Class Method Summary
- .new(name, options = {}) ⇒ Encrypted constructor
 
Standard - Inherited
| .new | Create the new field with a name and optional additional options.  | 
    
Instance Attribute Summary
- #deterministic? ⇒ true | false | nil readonly
 
Standard - Inherited
| #default_val | Defines the behavior for defined fields in the document.  | 
    
| #foreign_key? | Is this field a foreign key?  | 
    
| #label | Defines the behavior for defined fields in the document.  | 
    
| #lazy? | Does this field do lazy default evaluation?  | 
    
| #localize_present? | Is the localized field enforcing values to be present?  | 
    
| #localized? | Is the field localized or not?  | 
    
| #name | Defines the behavior for defined fields in the document.  | 
    
| #object_id_field? | Is the field a BSON::ObjectId?  | 
    
| #options | Defines the behavior for defined fields in the document.  | 
    
| #pre_processed? | Does the field pre-process its default value?  | 
    
Instance Method Summary
- #key_id ⇒ String | nil
 - #key_name_field ⇒ String | nil
 - 
    
      #set_key_id(key_id)  
    
    Internal use only
    Internal use only
    
Override the key_id for the field.
 
Standard - Inherited
| #add_atomic_changes | Adds the atomic changes for this type of resizable field.  | 
    
| #association | Get the metadata for the field if its a foreign key.  | 
    
| #eval_default | Evaluate the default value and return it.  | 
    
| #type | Get the type of this field - inferred from the class name.  | 
    
| #default_name | Get the name of the default method for this field.  | 
    
| #define_default_method | Define the method for getting the default on the document.  | 
    
| #evaluate_default_proc | Evaluate the default proc.  | 
    
| #evaluated_default | Get the evaluated default.  | 
    
| #included? | Is the field included in the fields that were returned from the database? We can apply the default if:  | 
    
| #serialize_default | This is used when default values need to be serialized.  | 
    
Constructor Details
    .new(name, options = {})  ⇒ Encrypted 
  
# File 'lib/mongoid/fields/encrypted.rb', line 8
def initialize(name, = {}) @encryption_options = if [:encrypt].is_a?(Hash) [:encrypt] else {} end super end
Instance Attribute Details
    #deterministic?  ⇒ true | false | nil  (readonly)
  
# File 'lib/mongoid/fields/encrypted.rb', line 19
def deterministic? @encryption_options[:deterministic] end
Instance Method Details
    #key_id  ⇒ String | nil 
  
# File 'lib/mongoid/fields/encrypted.rb', line 25
def key_id @encryption_options[:key_id] end
    #key_name_field  ⇒ String | nil 
  
# File 'lib/mongoid/fields/encrypted.rb', line 31
def key_name_field @encryption_options[:key_name_field] end
#set_key_id(key_id)
Override the key_id for the field.
This method is solely for testing purposes and should not be used in the application code. The schema_map is generated very early in the application lifecycle, and overriding the key_id after that will not have any effect.