On Fri, Oct 05, 2012 at 03:43:39PM -0400, [email protected] wrote: > From: Tzu-Mainn Chen <[email protected]> > > --- > src/app/models/event.rb | 8 ++++++++ > 1 files changed, 8 insertions(+), 0 deletions(-) > > diff --git a/src/app/models/event.rb b/src/app/models/event.rb > index 5d17380..9819b66 100644 > --- a/src/app/models/event.rb > +++ b/src/app/models/event.rb > @@ -47,6 +47,14 @@ class Event < ActiveRecord::Base > > scope :lifetime, where(:status_code => [:first_running, :all_running, > :some_running, :all_stopped]) > > + def source > + case source_type > + when "Deployment" then Deployment.with_deleted.find(source_id) > + when "Instance" then Instance.with_deleted.find(source_id) > + else super > + end > + end > + > # Notifies the Event API if certain conditions are met > def transmit_event > # Extract just the old values from change_hash > -- > 1.7.6.5
ACK. This works as described, and is super-readable now. ;) Will push to master (only). -- Matt
