Module: Citier4::InstanceMethods::ForcedWriters

Defined in:
lib/citier4/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
18
19
20
21
# File 'lib/citier4/instance_methods.rb', line 8

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

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



23
24
25
26
# File 'lib/citier4/instance_methods.rb', line 23

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