Module: ArSync::ModelBase::ClassMethods::WriteHook

Defined in:
lib/ar_sync/class_methods.rb

Instance Method Summary collapse

Instance Method Details

#_initialize_sync_info_before_mutationObject



114
115
116
117
118
119
120
# File 'lib/ar_sync/class_methods.rb', line 114

def _initialize_sync_info_before_mutation
  self.class.default_scoped.scoping do
    @_sync_watch_values_before_mutation ||= _sync_current_watch_values
    @_sync_parents_info_before_mutation ||= _sync_current_parents_info
    @_sync_belongs_to_info_before_mutation ||= _sync_current_belongs_to_info
  end
end

#_write_attribute(attr_name, value) ⇒ Object



121
122
123
124
# File 'lib/ar_sync/class_methods.rb', line 121

def _write_attribute(attr_name, value)
  _initialize_sync_info_before_mutation
  super attr_name, value
end

#write_attribute(attr_name, value) ⇒ Object



125
126
127
128
# File 'lib/ar_sync/class_methods.rb', line 125

def write_attribute(attr_name, value)
  _initialize_sync_info_before_mutation
  super attr_name, value
end