Module: Huberry::AttrEncrypted::Adapters::ActiveResource::InstanceMethods

Defined in:
lib/huberry/attr_encrypted/adapters/active_resource.rb

Instance Method Summary collapse

Instance Method Details

#save_with_encrypted_attributesObject

Calls the assignment method of each attribute so they are encrypted. Objects modified in place would not get saved otherwise.



11
12
13
14
15
16
17
18
# File 'lib/huberry/attr_encrypted/adapters/active_resource.rb', line 11

def save_with_encrypted_attributes
  self.class.encrypted_attributes.keys.each do |attribute|
    if respond_to?(attribute)
      send(:"#{attribute}=", send(attribute.to_sym))
    end
  end
  save_without_encrypted_attributes
end