Sha256: fc5a60d0633e9156c6a8d3204d3e0411a0650c81c88f908a294fc50ebb050dce
Contents?: true
Size: 492 Bytes
Versions: 10
Compression:
Stored size: 492 Bytes
Contents
class JuggernautObserver < ActiveRecord::Observer observe :activity, :user def after_create(rec) publish(:create, rec) end def after_update(rec) publish(:update, rec) end def after_destroy(rec) publish(:destroy, rec) end protected def publish(type, rec) Juggernaut.publish( Array(rec.sync_clients).map {|c| "/sync/#{c}" }, {:type => type, :id => rec.id, :klass => rec.class.name, :record => rec} ) end end
Version data entries
10 entries across 10 versions & 2 rubygems