Module: ActiveRecord::Acts::ActsAsSecure::ClassMethods::InstanceMethods
- Defined in:
- lib/acts_as_secure/acts_as_secure.rb
Instance Method Summary collapse
- #decrypt_secure_columns ⇒ Object
- #encrypt_secure_columns ⇒ Object
- #read_attribute_before_decryption(attr_name) ⇒ Object
Instance Method Details
#decrypt_secure_columns ⇒ Object
80 81 82 83 84 85 86 |
# File 'lib/acts_as_secure/acts_as_secure.rb', line 80 def decrypt_secure_columns @encrypted_attributes = {} self.class.secure_columns.each do |col| @encrypted_attributes[col.name] = send("#{ col.name }_before_type_cast") self[col.name] = secure_decrypt(send("#{ col.name }_before_type_cast")) unless self[col.name].nil? end end |
#encrypt_secure_columns ⇒ Object
74 75 76 77 78 |
# File 'lib/acts_as_secure/acts_as_secure.rb', line 74 def encrypt_secure_columns self.class.secure_columns.each do |col| self[col.name] = secure_encrypt(self[col.name]) end end |
#read_attribute_before_decryption(attr_name) ⇒ Object
88 89 90 91 92 93 94 |
# File 'lib/acts_as_secure/acts_as_secure.rb', line 88 def read_attribute_before_decryption(attr_name) if @encrypted_attributes[attr_name.to_s].nil? self[attr_name] else @encrypted_attributes[attr_name.to_s] end end |