1. Setup your Iron.io Credentials and Project ID
If you haven't already, read this page to set up your credentials: http://dev.iron.io/articles/configuration/
To choose a specific project for this, add an iron.json file in this directory with:
{
"project_id": "MY_IRON_PROJECT_ID"
}
Or set the IRON_PROJECT_ID
environment variable.
Or if you're using the IronMQ Heroku add-on, you don't need to do either of those.
Clone this github repository then start up the app with:
rails s
rake jobs:work
4. Surf to localhost:3000
And watch the worker output on the console.
Take a look at WelcomeController.index
and User
model to see what's going on. In WelcomeController.index
it's calling:
user = User.new
user.delay.background_stuff(WelcomeController.increment)
So User.background_stuff
is being called in the background.