Created
June 3, 2012 11:41
-
-
Save npj/2863154 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# app/models/my_model.rb | |
class MyModel < ActiveRecord::Base | |
def async_background_method(arg1, arg2) | |
Queue::Normal.enqueue(self, :background_method, arg1, arg2) | |
end | |
# this happens in the background, | |
def background_method(arg1, arg2) | |
# do something that takes a long time... | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment