Sha256: a693f2887fbbe1b504f26e6030af18278b2079c04a8c216aff3067d2c2699a6f
Contents?: true
Size: 835 Bytes
Versions: 17
Compression:
Stored size: 835 Bytes
Contents
# frozen_string_literal: true require "active_job/arguments" module AcidicJob module Arguments include ActiveJob::Arguments extend self # rubocop:disable Style/ModuleFunction # `ActiveJob` will throw an error if it tries to deserialize a GlobalID record. # However, this isn't the behavior that we want for our custom `ActiveRecord` serializer. # Since `ActiveRecord` does _not_ reset instance record state to its pre-transactional state # on a transaction ROLLBACK, we can have GlobalID entries in a serialized column that point to # non-persisted records. This is ok. We should simply return `nil` for that portion of the # serialized field. def deserialize_global_id(hash) GlobalID::Locator.locate hash[GLOBALID_KEY] rescue ActiveRecord::RecordNotFound nil end end end
Version data entries
17 entries across 17 versions & 1 rubygems