Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
# app/models/my_model.rb
class MyModel < ActiveRecord::Base
def async_background_method(arg1, arg2)
Queue::Normal.enqueue(self, :background_method, arg1, arg2)
# this happens in the background,
def background_method(arg1, arg2)
# do something that takes a long time...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment