Module: Citier::InstanceMethods::ForcedWriters

Defined in:
lib/citier/instance_methods.rb

Instance Method Summary collapse

Instance Method Details

#force_attributes(new_attributes, options = {}) ⇒ Object



8
9
10
11
12
13
14
15
16
17
# File 'lib/citier/instance_methods.rb', line 8

def force_attributes(new_attributes, options = {})
  new_attributes = @attributes.merge(new_attributes) if options[:merge]
  @attributes = new_attributes
  
  if options[:clear_caches] != false
    @aggregation_cache = {}
    @association_cache = {}
    @attributes_cache = {}
  end
end

#force_changed_attributes(new_changed_attributes, options = {}) ⇒ Object



19
20
21
22
# File 'lib/citier/instance_methods.rb', line 19

def force_changed_attributes(new_changed_attributes, options = {})
  new_changed_attributes = @attributes.merge(new_changed_attributes) if options[:merge]
  @changed_attributes = new_changed_attributes
end