Indentify delayed_job with display_name


I just found this solution for identifying a job in the job table:

They are using this code:

class MyJob <;
def perform
# …

def display_name
    return "MyJob-User-#{user_id}"


store reference to a User

my_job = # is 1
job = Delayed::Job.enqueue(my_job, 0, 1.hour.from_now)

=> “MyJob-User-1”


=> “— !ruby/struct:MyJob \nuser_id: 1\n”

This is great and this is exactly what I need. I am just wondering
that I never read the display_name menthod before. Is that only for
the delayed_job objects or is that possible for every active record?

Where is that display_name stored?

Thanks in advance!

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs