Skip to content

Instantly share code, notes, and snippets.

@michalvalasek
Created April 16, 2012 12:14
Show Gist options
  • Save michalvalasek/2398329 to your computer and use it in GitHub Desktop.
Save michalvalasek/2398329 to your computer and use it in GitHub Desktop.
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