Skip to content

Instantly share code, notes, and snippets.

@EBashkoff
Created December 14, 2015 16:15
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save EBashkoff/302dc5f97e1e707b3d9d to your computer and use it in GitHub Desktop.
Save EBashkoff/302dc5f97e1e707b3d9d to your computer and use it in GitHub Desktop.
Get Objects from Delayed Job
Get a deserialized object from a delayed job:
1. Get the delayed_job record using the id: dj = DelayedJob.find(<id>)
2. Get the handler field from dj: dj.handler
3. Convert it from YAML: YAML.parse(dj.handler)
4. You can get the ruby objects that the delayed job was built with by converting that to_ruby and calling the object:
YAML.parse(dj.handler).to_ruby.user
YAML.parse(dj.handler).to_ruby.prospect
YAML.parse(dj.handler).to_ruby.agent
etc.
@evmorov
Copy link

evmorov commented Apr 7, 2021

There is a method payload_object

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment