|
1 | 1 | # frozen_string_literal: true |
2 | 2 |
|
3 | 3 | require_relative 'yaml_loader' |
| 4 | +require_relative 'compatibility' |
4 | 5 |
|
5 | 6 | module Delayed |
6 | 7 | module JobGroups |
7 | 8 | class JobGroup < ActiveRecord::Base |
8 | 9 |
|
9 | 10 | self.table_name = "#{ActiveRecord::Base.table_name_prefix}delayed_job_groups" |
10 | 11 |
|
11 | | - serialize :on_completion_job, Delayed::JobGroups::YamlLoader |
12 | | - serialize :on_completion_job_options, Hash |
13 | | - serialize :on_cancellation_job, Delayed::JobGroups::YamlLoader |
14 | | - serialize :on_cancellation_job_options, Hash |
| 12 | + if Compatibility.rails_7_1_or_greater? |
| 13 | + serialize :on_completion_job, coder: YAML, yaml: { unsafe_load: true } |
| 14 | + serialize :on_completion_job_options, coder: YAML, type: Hash |
| 15 | + serialize :on_cancellation_job, coder: YAML, yaml: { unsafe_load: true } |
| 16 | + serialize :on_cancellation_job_options, coder: YAML, type: Hash |
| 17 | + else |
| 18 | + serialize :on_completion_job, Delayed::JobGroups::YamlLoader |
| 19 | + serialize :on_completion_job_options, Hash |
| 20 | + serialize :on_cancellation_job, Delayed::JobGroups::YamlLoader |
| 21 | + serialize :on_cancellation_job_options, Hash |
| 22 | + end |
| 23 | + |
15 | 24 |
|
16 | 25 | validates :queueing_complete, :blocked, :failure_cancels_group, inclusion: [true, false] |
17 | 26 |
|
|
0 commit comments