Fix failing test in 8d6efcbfb559e377a8f21873b736390035bc44ed.
[arvados.git] / services / api / app / models / log.rb
index 923a681b0d3a03dc55f671b82063abc286a2601a..f8e337b201018a7f2638fa551e1b9304e6334211 100644 (file)
@@ -4,17 +4,24 @@ class Log < ArvadosModel
   include CommonApiTemplate
   serialize :properties, Hash
   before_validation :set_default_event_at
-  attr_accessor :object
+  attr_accessor :object, :object_kind
 
   api_accessible :user, extend: :common do |t|
     t.add :object_uuid
     t.add :object, :if => :object
+    t.add :object_kind
     t.add :event_at
     t.add :event_type
     t.add :summary
     t.add :properties
   end
 
+  def object_kind
+    if k = ArvadosModel::resource_class_for_uuid(object_uuid)
+      k.kind
+    end
+  end
+
   def fill_object(thing)
     self.object_uuid ||= thing.uuid
     self.summary ||= "#{self.event_type} of #{thing.uuid}"