Module: AcidicJob::Arguments
- Extended by:
- Arguments
- Includes:
- ActiveJob::Arguments
- Included in:
- Arguments
- Defined in:
- lib/acidic_job/serializer.rb
Instance Method Summary collapse
-
#deserialize_global_id(hash) ⇒ Object
`ActiveJob` will throw an error if it tries to deserialize a GlobalID record.
Instance Method Details
#deserialize_global_id(hash) ⇒ Object
`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.
111 112 113 114 115 |
# File 'lib/acidic_job/serializer.rb', line 111 def deserialize_global_id(hash) GlobalID::Locator.locate hash[GLOBALID_KEY] rescue ActiveRecord::RecordNotFound nil end |