Sha256: 5ea137ba0ed3ab53ecf8b7230608e672bc5744dcd788d77833cd301df9ba2a00
Contents?: true
Size: 854 Bytes
Versions: 9
Compression:
Stored size: 854 Bytes
Contents
# frozen_string_literal: true module TableSync::Publishing::ORMAdapter module ActiveRecord module_function def model_naming(object) ::TableSync::NamingResolver::ActiveRecord.new(table_name: object.table_name) end def find(dataset, conditions) dataset.find_by(conditions) end def attributes(object) object.attributes end def setup_sync(klass, opts) debounce_time = opts.delete(:debounce_time) klass.instance_exec do { create: :created, update: :updated, destroy: :destroyed }.each do |event, state| after_commit(on: event, **opts) do TableSync::Publishing::Publisher.new(self.class.name, attributes, state: state, debounce_time: debounce_time).publish end end end end end end
Version data entries
9 entries across 9 versions & 1 rubygems