Skip to content

Commit

Permalink
Use the newer serialize signature if available
Browse files Browse the repository at this point in the history
On 7.1 serialize properly split `coder` and `type` arguments
instead of taking a single positional argument and try to figure
out which is which.

While we're at it, we can explictly define we're using YAML here
instead of relying on the default that is now configurable.
  • Loading branch information
byroot committed Feb 27, 2023
1 parent 3ab98c0 commit e2fd841
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions app/models/maintenance_tasks/run.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,13 @@ class Run < ApplicationRecord

attr_readonly :task_name

serialize :backtrace
serialize :arguments, JSON
if Rails.gem_version >= Gem::Version.new("7.1.alpha")
serialize :backtrace, coder: YAML
serialize :arguments, coder: JSON
else
serialize :backtrace
serialize :arguments, JSON
end

scope :active, -> { where(status: ACTIVE_STATUSES) }
scope :completed, -> { where(status: COMPLETED_STATUSES) }
Expand Down

0 comments on commit e2fd841

Please sign in to comment.