Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Update the Faye channel when a model is touched.

  • Loading branch information...
commit e75b65f89dd642367782c703a1a1ffc68c8b7743 1 parent 1ccbe7f
@patricksrobertson authored
Showing with 8 additions and 0 deletions.
  1. +8 −0 lib/backbone_sync-rails/faye/observer.rb
View
8 lib/backbone_sync-rails/faye/observer.rb
@@ -28,6 +28,14 @@ def after_destroy(model)
end
end
+ def after_touch(model)
+ begin
+ Event.new(model, :update).broadcast
+ rescue *NET_HTTP_EXCEPTIONS => e
+ handle_net_http_exception(e)
+ end
+ end
+
def handle_net_http_exception(exception)
::Rails.logger.error("")
::Rails.logger.error("Backbone::Sync::Rails::Faye::Observer encountered an exception:")
Please sign in to comment.
Something went wrong with that request. Please try again.