Class: ActiveRecord::DestroyAssociationAsyncJob
| Relationships & Source Files | |
| Super Chains via Extension / Inclusion / Inheritance | |
|
Class Chain:
|
|
|
Instance Chain:
|
|
| Inherits: |
ActiveJob::Base
|
| Defined in: | activerecord/lib/active_record/destroy_association_async_job.rb |
Overview
Job to destroy the records associated with a destroyed record in background.
Constant Summary
Class Attribute Summary
::ActiveJob::Base - Inherited
Class Method Summary
::ActiveSupport::DescendantsTracker - Inherited
| clear, descendants, direct_descendants, | |
| store_inherited | This is the only method that is not thread safe, but is only ever called during the eager loading phase. |
| subclasses | |
Instance Attribute Summary
::ActiveJob::Base - Inherited
::ActiveJob::Callbacks - Included
::ActiveJob::Execution - Included
::ActiveJob::Core - Included
| #arguments | Job arguments. |
| #enqueued_at | Track when a job was enqueued. |
| #exception_executions |
|
| #executions | Number of times this job has been executed (which increments on every retry, like after an exception). |
| #job_id | Job Identifier. |
| #locale |
|
| #priority= | Priority that the job will have (lower is more priority). |
| #provider_job_id | ID optionally provided by adapter. |
| #queue_name= | Queue in which the job will reside. |
| #scheduled_at |
|
| #serialized_arguments=, | |
| #timezone | Timezone to be used during the job. |
Instance Method Summary
::ActiveJob::Exceptions - Included
| #retry_job | Reschedules the job to be re-executed. |
::ActiveSupport::Callbacks - Included
| #run_callbacks | Runs the callbacks for the given event. |
::ActiveJob::Execution - Included
| #perform, | |
| #perform_now | Performs the job immediately. |
::ActiveSupport::Rescuable - Included
| #rescue_with_handler | Delegates to the class method, but uses the instance as the subject for rescue_from handlers (method calls, instance_exec blocks). |
::ActiveJob::Enqueuing - Included
| #enqueue | Enqueues the job to be performed by the queue adapter. |
::ActiveJob::QueuePriority - Included
| #priority | Returns the priority that the job will be created with. |
::ActiveJob::QueueName - Included
| #queue_name | Returns the name of the queue the job will be run on. |
::ActiveJob::Core - Included
| #deserialize | Attaches the stored job data to the current instance. |
| #initialize | Creates a new job instance. |
| #serialize | Returns a hash with the job data that can safely be passed to the queuing adapter. |
Instance Method Details
#perform(owner_model_name: nil, owner_id: nil, association_class: nil, association_ids: nil, association_primary_key_column: nil, ensuring_owner_was_method: nil)
[ GitHub ]# File 'activerecord/lib/active_record/destroy_association_async_job.rb', line 13
def perform( owner_model_name: nil, owner_id: nil, association_class: nil, association_ids: nil, association_primary_key_column: nil, ensuring_owner_was_method: nil ) association_model = association_class.constantize owner_class = owner_model_name.constantize owner = owner_class.find_by(owner_class.primary_key.to_sym => owner_id) if !owner_destroyed?(owner, ensuring_owner_was_method) raise DestroyAssociationAsyncError, "owner record not destroyed" end association_model.where(association_primary_key_column => association_ids).find_each do |r| r.destroy end end