Last active
August 29, 2015 14:27
-
-
Save maxschmeling/325d712b6652a9bf79a9 to your computer and use it in GitHub Desktop.
CallbackWorker
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
class CallbackWorker | |
include Sidekiq::Worker | |
def perform(global_id, method, *params) | |
model = GlobalID::Locator.locate(global_id) | |
model.send method, *params | |
end | |
end |
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
class Customer < ActiveRecord::Base | |
after_create do | |
CallbackWorker.perform_async self.to_global_id, :send_to_slack | |
end | |
def send_to_slack | |
# ... code to send notice to Slack channel | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment