Sha256: c8c5f40cf82fd000706813493f1db4cd89d62f36a896b5ff12d8f3257b74e8d1

Contents?: true

Size: 1.09 KB

Versions: 1

Compression:

Stored size: 1.09 KB

Contents

module AfterCommit
  def self.committed_records
    @@committed_records ||= []
  end

  def self.committed_records=(committed_records)
    @@committed_records = committed_records
  end
  
  def self.committed_records_on_create
    @@committed_records_on_create ||= []
  end
  
  def self.committed_records_on_create=(committed_records)
    @@committed_records_on_create = committed_records
  end
  
  def self.committed_records_on_update
    @@committed_records_on_update ||= []
  end
  
  def self.committed_records_on_update=(committed_records)
    @@committed_records_on_update = committed_records
  end
  
  def self.committed_records_on_destroy
    @@committed_records_on_destroy ||= []
  end
  
  def self.committed_records_on_destroy=(committed_records)
    @@committed_records_on_destroy = committed_records
  end
end

require 'after_commit/active_record'
require 'after_commit/connection_adapters'

ActiveRecord::Base.send(:include, AfterCommit::ActiveRecord)

Object.subclasses_of(ActiveRecord::ConnectionAdapters::AbstractAdapter).each do |klass|
  klass.send(:include, AfterCommit::ConnectionAdapters)
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
yipdw-after_commit-0.0.1 lib/after_commit.rb