[PATCH] allow event to find source even if source has been soft deleted

tzumainn at redhat.com tzumainn at redhat.com
Fri Oct 5 19:43:39 UTC 2012


From: Tzu-Mainn Chen <tzumainn at redhat.com>

---
 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




More information about the aeolus-devel mailing list