Class: AdoptionContactObserver

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

Instance Method Summary collapse

Instance Method Details

#after_update(adoption_contact) ⇒ Object


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

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

#publish(type, adoption_contact) ⇒ Object


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

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