0

I have a Rails 5 app, running both a postgresql DB for application data and MongoDB (mongoid) for analytics, generated by the fantastic ahoy gem.

Everything works great until I switch to asynchronous geocoding in config/initializers/ahoy.rb, which generates the error below:

ActiveJob::SerializationError (Unsupported argument type: Visit):

The app is using delayed_job, for background processing.

I there a workaround for this issue, or is this caused by incompatibility between mongoid and delayed_job?

benrs44
  • 3
  • 2

1 Answers1

0

Try adding the GlobalId mixin to your model

class Visit
  include GlobalID::Identification
end
Andrew Kane
  • 3,200
  • 19
  • 40
  • Thanks, @AndrewKane. This helps in creating the job, but now I'm getting a new error when delayed_job looks to perform the geocoding: `ActiveJob::DeserializationError: Error while trying to deserialize arguments: Document(s) not found for class Visit with id(s) #` I've tried to see what could be causing this, and found [this](https://stackoverflow.com/questions/39055708/using-sidekiq-for-active-job-and-getting-activejobdeserializationerror) on stack exchange: What do you think about passing the id into the perform method? – benrs44 Nov 19 '17 at 19:34