public
Created

  • Download Gist
observer.rb
Ruby
1 2 3 4 5 6 7 8 9 10 11 12 13 14
def notify_of_deal_state_change
return unless state_changed?
 
Deal.changed
 
case state
when 'closed'
Deal.notify_observers 'deal_closed', self
when 'rejected'
Deal.notify_observers 'deal_rejected', self
when 'pending'
Deal.notify_observers 'deal_reopened', self
end
end

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.