Module: TouchRecords::ClassMethods

Defined in:
backend/app/model/mixins/touch_records.rb

Instance Method Summary collapse

Instance Method Details

#create_from_json(json, opts = {}) ⇒ Object



40
41
42
43
44
# File 'backend/app/model/mixins/touch_records.rb', line 40

def create_from_json(json, opts = {})
  obj = super
  touch(obj)
  obj
end

#touch(obj) ⇒ Object



46
47
48
49
50
51
52
53
# File 'backend/app/model/mixins/touch_records.rb', line 46

def touch(obj)
  return unless obj.class.respond_to? :touch_records
  records = obj.class.touch_records(obj)
  return unless records.any?
  records.each do |record_set|
    record_set[:type].update_mtime_for_ids(record_set[:ids].compact)
  end
end