Skip to content

Commit

Permalink
Add Active Support load hooks for Job and (Discrete)Execution; move a…
Browse files Browse the repository at this point in the history
…ll outside class definition bodies (#1414)
  • Loading branch information
bensheldon authored Jul 10, 2024
1 parent dd81bc5 commit 7b98077
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 6 deletions.
4 changes: 2 additions & 2 deletions app/controllers/good_job/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def current_locale
I18n.default_locale
end
end

ActiveSupport.run_load_hooks(:good_job_application_controller, self)
end
end

ActiveSupport.run_load_hooks(:good_job_application_controller, GoodJob::ApplicationController)
4 changes: 2 additions & 2 deletions app/models/good_job/base_record.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def self.with_logger_silenced(silent: true, &block)
def self.bind_value(name, value, type_class)
Arel::Nodes::BindParam.new(ActiveRecord::Relation::QueryAttribute.new(name, value, type_class.new))
end

ActiveSupport.run_load_hooks(:good_job_base_record, self)
end
end

ActiveSupport.run_load_hooks(:good_job_base_record, GoodJob::BaseRecord)
2 changes: 2 additions & 0 deletions app/models/good_job/discrete_execution.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,5 @@ def filtered_error_backtrace
end
end
end

ActiveSupport.run_load_hooks(:good_job_execution, GoodJob::DiscreteExecution)
2 changes: 2 additions & 0 deletions app/models/good_job/job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -224,3 +224,5 @@ def _discard_job(message)
end
end
end

ActiveSupport.run_load_hooks(:good_job_job, GoodJob::Job)
4 changes: 2 additions & 2 deletions lib/good_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,6 @@ def self.deprecator
def self.migrated?
true
end

ActiveSupport.run_load_hooks(:good_job, self)
end

ActiveSupport.run_load_hooks(:good_job, GoodJob)

0 comments on commit 7b98077

Please sign in to comment.