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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T17:34:32+00:00 2026-06-15T17:34:32+00:00

Trying to get delayed_job working. I want to do a http post to another

  • 0

Trying to get delayed_job working. I want to do a http post to another server without blocking my rails app. I figured delayed_job would be a good idea. However I am not able to get it to work.

Primarily in the controller if I hit a condition I want to do a http post to a known server.
What I have not understood so far is

  1. Can I delay a function defined in the controller itself?
  2. Do i need to define a separate class and have the function there which I can then include in the controller?

Steps so far:

  • Added gem ‘delayed_job_active_record’ to Gem file
  • Added gem “daemons” also
  • rails generate delayed_job:upgrade
  • rake db:migrate
  • ran RAILS_ENV=development script/delayed_job start

Then execute the code.
Code in the controller:

Attempt 1: # Leads to NoMethodError (undefined method post_to_server for SimpleObjectForTestController )

class SimpleObjectForTestController 
 def create
  ....
  if( some condition )
    SimpleObjectForTestController.delay.post_to_server
  end
  ....
 end
 def post_to_server
     Typhoeus::Request.post( "http://127.0.0.1:4567/hi", :body => $fixed_config )
 end
end

Attempt 2: Also gives same error now with SeperatedClass

 class SeperatedClass
    def post_to_server
       Typhoeus::Request.post( "http://127.0.0.1:4567/hi", :body => $fixed_config )
    end
 end
 class SimpleObjectForTestController
  def create
    ....
    if( some condition )
       SeperatedClass.delay.post_to_server
    end
    ....
  end
end

Some other context:
This is a non UI application.
Using Rails 3.2.6
Ruby 1.9.2
Using delayed_job (3.0.3)
Using delayed_job_active_record (0.3.2)

Can someone tell me what I am doing wrong?

  • 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-15T17:34:32+00:00Added an answer on June 15, 2026 at 5:34 pm

    Your post_to_server is a instance method.
    This should work:

    def self.post_to_server
      ...
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Trying to get JQuery to post JSON to a server: $.ajax({ url: /path/to/url, type:
I am trying to get delayed_job working as a windows service. I am so
Trying to get delayed_job working with a mongoid backend. The created job fails to
I'm trying to do this with delayed_job and HTTParty : HTTParty.delay.get('http://example.com') It successfully saves
Im trying get all my maingroups with its related entities. And i would also
On my local machine I'm trying to start my rails app and delayed job
I'm in the middle of trying to upgrade pieces of our app to Rails
So I'm trying to get my rails application to send particular emails at selected
I am a NOOB trying to work with delayed_job. I want to update a
I am trying to use delayed_job on heroku and I get the following error:

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.