3072: rendering "Empty Collection" in default_name
[arvados.git] / apps / workbench / app / models / collection.rb
index 008d108fd43ed8a7e0a3abe45cc380492b03ba4b..764817509ac98ccb936a9d1d162758ef7da7cef4 100644 (file)
@@ -1,6 +1,14 @@
 class Collection < ArvadosBase
   MD5_EMPTY = 'd41d8cd98f00b204e9800998ecf8427e'
 
+  def default_name
+    if Collection.is_empty_blob_locator? self.uuid
+      "Empty Collection"
+    else
+      super
+    end
+  end
+
   # Return true if the given string is the locator of a zero-length blob
   def self.is_empty_blob_locator? locator
     !!locator.to_s.match("^#{MD5_EMPTY}(\\+.*)?\$")