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 8809559
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T02:54:23+00:00 2026-06-14T02:54:23+00:00

I am using an special approach to deliver email. First, I abstract the call

  • 0

I am using an special approach to deliver email.

First, I abstract the call of method for delivering email into a control method send_email
Second, I delayed the execution of the control method.

It seems to be fine to send some value that are hard-coded into the method for delivering email, but not the value passed into that method.

Control method:

  # this method is being delayed to control the time of sending email
  def send_email

    # approach 1 : just send a email after method send_email is executed 
    # In delay situtation : after 2 minutes
    # Otherwise : no delay
    Notifier.create_long_task(1234).deliver

    # approach 2: explicitly states to delay sending email process 
    # (same result with the above one)
    # 
    # Notifier.delay.create_long_task(1234)
  end

  handle_asynchronously :send_email, :run_at => Proc.new { 2.minutes.from_now }

In the above codes, I passed 1234 into delivering method and below the delivering method will assign 1234 to an instance variable @id

 def create_long_task(longTask_id)
    @greeting = "Hi"
    @longTask ="delay setting"
    @id = longTask_id

    mail to: "j-@hotmail.com", :subject => 'Long Task Created'
  end

The email template looks like :

    Notifier#create_long_task
    Instance variable 1 : <%= @greeting %>
    Instance variable 2 : <%= @longTask %>
    Instance Id : <%= @id %>
    You created a long task 

So to be optimistic, the email will show 3 instance variables, 2 are hard-coded in the delivering method, one is passed into delivering method from outside

But the results only can show 2 instance variables that are hard-coded in the delivering method.

Notifier#create_long_task
Instance variable 1 : Hi
Instance variable 2 : delay setting
Instance Id : 
You created a long task 

It is very strange.
When I comment out handle_asynchronously to send the email without any delay, I can see all the instance variables. So I think that 1234 cannot be passed into delivering method.
Result of no delay email just like:

Notifier#create_long_task
Instance variable 1 : Hi
Instance variable 2 : delay setting
Instance Id : 1234
You created a long task 

This is a very long,complicated problem statement, I really appreciate if anyone can solve this problem.

  • 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-06-14T02:54:24+00:00Added an answer on June 14, 2026 at 2:54 am

    Don’t forget to restart delayed job as it won’t pick up changes to your code until you do.

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

Sidebar

Related Questions

I'm using the getX() and getY() method on a view for some special dragging
I am using code first approach in a ASP.NET MVC 3 application and all
Replacing the Special Character using Perl while i am doing this . I got
How to replace special characters using regular expressions? By special, what I mean is
Im using Umbraco 4.7 and registered a special property called umbracoUrlName which enables me
I'm using ASP.NET Roles with a special role Must Change Password. If a user
am using jquery tablesorter plugin and in my country column i got special characters
Currently I am using the following oneliner for the removal of special characters: sed
How to validate special characters in a textbox without using Validate plugin on JQuery
I cannot download file using java if the url contains special characters. eg:-http://something.com/something/this+this+this.html http://something.com/something/this%20this%20this.html

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.