Sha256: 06ec0521b0d2bbadb973171ce8cd957b4ed28b41f33da0321d667eec5e391050
Contents?: true
Size: 726 Bytes
Versions: 4
Compression:
Stored size: 726 Bytes
Contents
class Apisync module ActiveRecordExtension def self.included(klass) klass.extend(ClassMethods) klass.include(InstanceMethods) end module InstanceMethods attr_accessor :apisync private def apisync_on_after_initialize @apisync = Apisync::Rails::Model.new(self) @apisync.instance_eval(&self.class.apisync_block) end def apisync_on_after_commit @apisync.sync end end module ClassMethods def apisync_block @apisync_block end def apisync(&block) after_initialize :apisync_on_after_initialize after_commit :apisync_on_after_commit @apisync_block = block end end end end
Version data entries
4 entries across 4 versions & 1 rubygems