Class: FosterContactObserver

Inherits:
ActiveRecord::Observer
  • Object
show all
Defined in:
app/models/foster_contact_observer.rb

Instance Method Summary collapse

Instance Method Details

#after_update(foster_contact) ⇒ Object


4
5
6
# File 'app/models/foster_contact_observer.rb', line 4

def after_update(foster_contact)
    publish(:update, foster_contact)
end

#publish(type, foster_contact) ⇒ Object


8
9
10
11
12
13
14
15
16
# File 'app/models/foster_contact_observer.rb', line 8

def publish(type, foster_contact)
  Juggernaut.url = ENV['JUGG_URL']
  Juggernaut.publish("/observer/foster_contact/#{foster_contact.id}", {
    :id     => foster_contact.id, 
    :type   => type, 
    :klass  => foster_contact.class.name,
    :record => foster_contact.changes
  })
end