lib/acidic_job/run.rb in acidic_job-1.0.0.pre26 vs lib/acidic_job/run.rb in acidic_job-1.0.0.pre27
- old
+ new
@@ -1,10 +1,11 @@
# frozen_string_literal: true
require "active_record"
require "global_id"
require "active_support/core_ext/object/with_options"
+require_relative "./serializer"
module AcidicJob
class Run < ActiveRecord::Base
include GlobalID::Identification
@@ -15,14 +16,14 @@
belongs_to :awaited_by, class_name: "AcidicJob::Run", optional: true
has_many :batched_runs, class_name: "AcidicJob::Run", foreign_key: "awaited_by_id"
after_create_commit :enqueue_staged_job, if: :staged?
- serialize :error_object
- serialize :serialized_job
- serialize :workflow
- serialize :returning_to
- store :attr_accessors
+ serialize :serialized_job, JSON
+ serialize :error_object, Serializer
+ serialize :workflow, Serializer
+ serialize :returning_to, Serializer
+ store :attr_accessors, coder: Serializer
validates :staged, inclusion: { in: [true, false] } # uses database default
validates :serialized_job, presence: true
validates :idempotency_key, presence: true, uniqueness: true
validates :job_class, presence: true