Anyone know of a clean way to avoid the ActiveJob::SerializationError that occurs when trying to serialize a Date or Time object?
The two solutions I've had so far are to:
- Call Marshal/JSON/YAML dumpwhen loading the arguments and thenloadback in the Job (which sucks because I need to monkey patch the mailer job)
- Monkey patch DateandTimelike so:
/lib/core_ext/time.rb
class Time
  include GlobalID::Identification
  def id
    self.to_i
  end
  def self.find(id)
    self.at(id.to_i)
  end
end
/lib/core_ext/date.rb
class Date
  include GlobalID::Identification
  def id
    self.to_time.id
  end
  def self.find(id)
    Time.find(id).to_date
  end
end
Which also sucks. Anyone have a better solution?
 
     
    