Skip to content

Instantly share code, notes, and snippets.

@patrickgombert
Created July 28, 2011 20:06
Show Gist options
  • Save patrickgombert/1112422 to your computer and use it in GitHub Desktop.
Save patrickgombert/1112422 to your computer and use it in GitHub Desktop.
ActiveRecord::Dirty Pusher example
class Example < ActiveRecord::Base
after_save { push_updates if changed? }
private
def push_updates
if self.my_attribute_changed?
Pusher["channel-example"].trigger!("my-attribute-update", {:my_attribute => self.my_attribute})
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment