Class: OrganizationObserver

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

Instance Method Summary collapse

Instance Method Details

#after_update(organization) ⇒ Object


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

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

#publish(type, organization) ⇒ Object


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

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