lib/rocket_job/sliced/slice.rb in rocketjob-5.4.1 vs lib/rocket_job/sliced/slice.rb in rocketjob-6.0.0.rc1
- old
+ new
@@ -31,11 +31,11 @@
#
# Read-only attributes
#
# Current state, as set by AASM
- field :state, type: Symbol, default: :queued
+ field :state, type: Mongoid::StringifiedSymbol, default: :queued
# When processing started on this slice
field :started_at, type: Time
# Number of times that this job has failed to process
@@ -137,21 +137,13 @@
at(processing_record_number - 1) if exception && processing_record_number
end
# Returns [Hash] the slice as a Hash for storage purposes
# Compresses / Encrypts the slice according to the job setting
- if ::Mongoid::VERSION.to_i >= 6
- def as_attributes
- attrs = super
- attrs["records"] = serialize_records if @records
- attrs
- end
- else
- def as_document
- attrs = super
- attrs["records"] = serialize_records if @records
- attrs
- end
+ def as_attributes
+ attrs = super
+ attrs["records"] = serialize_records if @records
+ attrs
end
def inspect
"#{super[0...-1]}, records: #{@records.inspect}, collection_name: #{collection_name.inspect}>"
end