Created
April 16, 2012 12:14
-
-
Save michalvalasek/2398329 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
module AsynchronousPush | |
module ClassMethods | |
def push_to_network(entity_network_id) | |
entity_network = self.find(entity_network_id) | |
if entity_network.remote_id | |
entity_network.update_remote | |
else | |
entity_network.build_remote | |
end | |
end | |
end | |
def self.included(base) | |
base.extend(ClassMethods) | |
end | |
def async_network_push | |
self.class.delay.push_to_network(self.id) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment