Created
July 28, 2011 20:06
-
-
Save patrickgombert/1112422 to your computer and use it in GitHub Desktop.
ActiveRecord::Dirty Pusher example
This file contains hidden or 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 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