Linked Questions

Popular Questions

Rails - after_initialize or initializer

Asked by At

Whenever my Rails 4 application loads after a deployment, I want to make a REST APi call to another application to tell it my app is ready and kick off some tests.

I was initially going to do this in the initialzers folder, but then I figured that it executes this stuff while the app is initializing and the app may not be fully initialized, so if it kicks off some tests, it may fail.

Then I read about the after_initialize, but I'm not sure how to use it and where the code should go to make the rest call after the app is fully loaded?

Can some one help?

Here is the code I want to run when the app has loaded:

   response =,
                    :basic_auth => @auth
    puts response.message

Related Questions