Module: EncryptAttributes::Adapters::Base

Included in:
ActiveRecord, Mongoid
Defined in:
lib/encrypt_attributes/adapters/base.rb

Instance Method Summary collapse

Instance Method Details

#read_encrypted_attribute(attr_name) ⇒ Object



4
5
6
# File 'lib/encrypt_attributes/adapters/base.rb', line 4

def read_encrypted_attribute(attr_name)
  encryptor.decrypt(read_attribute(attr_name))
end

#write_encrypted_attribute(attr_name, attr_value) ⇒ Object



8
9
10
# File 'lib/encrypt_attributes/adapters/base.rb', line 8

def write_encrypted_attribute(attr_name, attr_value)
  write_attribute(attr_name, encryptor.encrypt(attr_value))
end