def write_encrypted_attribute(attr_name, to_attr_name, cipher_class, options)
        value = send(attr_name)
        
        # Only encrypt values that actually have content and have not already
        # been encrypted
        unless value.blank? || value.encrypted?
          callback("before_encrypt_#{attr_name}")
          
          # Create the cipher configured for this attribute
          cipher = create_cipher(cipher_class, options, value)
          
          # Encrypt the value
          value = cipher.encrypt(value)
          value.cipher = cipher
          
          # Update the value based on the target attribute
          send("#{to_attr_name}=", value)
          
          callback("after_encrypt_#{attr_name}")
        end
      end
def write_encrypted_attribute(attr_name, to_attr_name, cipher_class, options)
        value = send(attr_name)
        
        # Only encrypt values that actually have content and have not already
        # been encrypted
        unless value.blank? || value.encrypted?
          callback("before_encrypt_#{attr_name}")
          
          # Create the cipher configured for this attribute
          cipher = create_cipher(cipher_class, options, value)
          
          # Encrypt the value
          value = cipher.encrypt(value)
          value.cipher = cipher
          
          # Update the value based on the target attribute
          send("#{to_attr_name}=", value)
          
          callback("after_encrypt_#{attr_name}")
        end
      end
Encrypts the given attribute to a target location using the encryption
 options configured for that attribute