Flowdock
method

add_after_commit_jobs_callback

Importance_0
v6.1.3.1 - Show latest stable - 0 notes - Class: Association
add_after_commit_jobs_callback(model, dependent) private

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Hide source
# File activerecord/lib/active_record/associations/builder/association.rb, line 139
    def self.add_after_commit_jobs_callback(model, dependent)
      if dependent == :destroy_async
        mixin = model.generated_association_methods

        unless mixin.method_defined?(:_after_commit_jobs)
          model.after_commit(-> do
            _after_commit_jobs.each do |job_class, job_arguments|
              job_class.perform_later(**job_arguments)
            end
          end)

          mixin.class_eval             def _after_commit_jobs              @_after_commit_jobs ||= []            end, __FILE__, __LINE__ + 1
        end
      end
    end
Register or log in to add new notes.