Module: AttrEncrypted::ActiveRecord
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/attr_encrypted/adapters/active_record.rb
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
- #assign_attributes_with_attr_encrypted(new_attributes) ⇒ Object
- #reload_with_attr_encrypted(*args, &block) ⇒ Object
Instance Method Details
#assign_attributes_with_attr_encrypted(new_attributes) ⇒ Object
40 41 42 43 44 45 46 47 |
# File 'lib/attr_encrypted/adapters/active_record.rb', line 40 def assign_attributes_with_attr_encrypted(new_attributes) return if new_attributes.blank? new_attributes = new_attributes. encrypted_part = new_attributes.extract!(*self.class.encrypted_attributes.keys) assign_attributes_without_attr_encrypted(new_attributes) assign_attributes_without_attr_encrypted(encrypted_part) end |
#reload_with_attr_encrypted(*args, &block) ⇒ Object
32 33 34 35 36 37 38 |
# File 'lib/attr_encrypted/adapters/active_record.rb', line 32 def reload_with_attr_encrypted(*args, &block) reload_without_attr_encrypted(*args, &block).tap do self.class.encrypted_attributes.each_key do |attribute_name| instance_variable_set(:"@#{attribute_name}", nil) end end end |