Sha256: 83a6036927a8c395c39b0171e877d442f14e1995f69395943e6adf1808eae5a8

Contents?: true

Size: 613 Bytes

Versions: 1

Compression:

Stored size: 613 Bytes

Contents

class Tester < ActiveRecord::Base
  include AfterCommitAction

  after_initialize :after_initialize

  before_create :before_create
  after_create :after_create
  before_update :before_update
  after_update :after_update

  attr_reader :array

  def after_initialize
    @array = []
  end

  def before_create
    execute_after_commit { @array<< 'before_create' }
  end

  def after_create
    execute_after_commit { @array<< 'after_create' }
  end

  def before_update
    execute_after_commit { @array<< 'before_update' }
  end

  def after_update
    execute_after_commit { @array<< 'after_update' }
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
after_commit_action-1.0.0 spec/models/tester.rb