Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3216152
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T15:15:39+00:00 2026-05-17T15:15:39+00:00

I get the following error: Delayed::Job SomeMailJob# (NoMethodError) undefined method `subject’ for #<YAML::Object:0x2b0a191f4c78> This

  • 0

I get the following error:

Delayed::Job SomeMailJob# (NoMethodError) "undefined method `subject' for #<YAML::Object:0x2b0a191f4c78>"

This comes from the following code which references the SombMailJob above:

 class SomeMailJob < Struct.new(:contact, :contact_email) 
   def perform
     OutboundMailer.deliver_campaign_email(contact,contact_email)
   end
 end

Here is the mailer:

class OutboundMailer < Postage::Mailer 

  def campaign_email(contact,email)
    subject    email.subject
    recipients contact.email
    from       'me.com>'
    sent_on    Date.today

    body       :email => email
  end

This is the cron task that invokes the mailer:

Contact.all.each do |contact|
  email = contact.email_today #email_today is a contact method returning email object if <= today

  unless contact.email_today == "none" || email.nil?
    puts "contact info inside cron job"
    puts contact.first_name
    puts email.days
    puts contact.date_entered
    puts contact.colleagues
    puts "substituted subject:"
    puts email.substituted_subject(contact,contact.colleagues)

    # create the Contact Email object that gets created and sent

    contact_email = ContactEmail.new
    contact_email.contact_id = contact.id
    contact_email.email_id = email.id

    contact_email.subject = email.substituted_subject(contact,contact.colleagues)


    puts contact_email.subject

    contact_email.date_sent = Date.today
    contact_email.date_created = Date.today

    contact_email.body = email.substituted_message(contact, contact.colleagues)

    contact_email.status = "sent" 

    #Delayed::Job.enqueue OutboundMailer.deliver_campaign_email(contact,contact_email)
    Delayed::Job.enqueue SomeMailJob.new(contact,contact_email)

    contact_email.save #now save the record

Question: why am I getting this error? I don’t even know what the object is because it is coming up with the code, so I can’t really drill-down further to debug.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T15:15:40+00:00Added an answer on May 17, 2026 at 3:15 pm

    When you enqueue a delayed job, it serializes the things involved (the class, the name of hte method you’re calling on it, the arguments) into YAML so it can pull them out later when running the job and work with them.

    It looks like in your case the email argument is not getting deserialized properly from YAML before .subject is called on it.

    I’ve found that delayed_job tends to have trouble serializing/deserializing anything that’s not a simple stored ActiveRecord object or primitive type (integer, string). I always try to set things up so my Job objects only take record IDs (integers), then in the perform method I find for the objects there and work with them. This would definitely avoid the trouble you’re seeing.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I get the following error: undefined method `[]' for nil:NilClass The related snippet in
I am using the code as described in this question. However get following error
After deploying DelayedJob as a gem, I got the following error: undefined method `handle_asynchronously'
This is my code for AES. Under Gingerbread I get following error after encrypting
After downgrading* symfony-standard to 2.0.4 I get following error: Notice: Undefined index: locale in
I have this import in my code: import com.sun.jmx.snmp.SnmpOidDatabaseSupport; but i get following error:
I get the following error when I run my task via DelayedJob: closed stream
I get following error (SyntaxError): missing ] after element list when using eval function.
I get following error message, when I try to run git rebase -i for
I get following error when deploying on test server with II6 and Framework 3.5

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.