class Object

Public Instance Methods

call_before_commit_records() click to toggle source
# File lib/pub_sub_model_sync/initializers/before_commit.rb, line 14
def call_before_commit_records
  ite = records.uniq
  ite.each do |record|
    action = record.previous_changes.include?(:id) ? :create : :update
    action = :destroy if record.destroyed?
    callback_name = "ps_before_#{action}_commit".to_sym
    record.send(callback_name) if record.respond_to?(callback_name)
  end
end
commit() click to toggle source
# File lib/pub_sub_model_sync/initializers/before_commit.rb, line 7
def commit
  call_before_commit_records if PubSubModelSync::Config.enable_rails4_before_commit
  commit_without_before_commit
end