11807: Migrate old records in jobs table from YAML to JSON.
[arvados.git] / apps / workbench / app / controllers / collections_controller.rb
index bfba2f57f8616facadc818e3d4c016d8206d92c0..515cdf1867fba103fce298daf7cf2ecd755d1f8d 100644 (file)
@@ -350,18 +350,19 @@ class CollectionsController < ApplicationController
   end
 
   def save_tags
-    tags = nil
-    if params['tag_data']
-      tags = params['tag_data']
-    elsif params['empty']
-      tags = {}
+    tags_param = params['tag_data']
+    if tags_param
+      if tags_param.is_a?(String) && tags_param == "empty"
+        tags = {}
+      else
+        tags = tags_param
+      end
     end
 
     if tags
-      props = @object.properties
-      props[:tags] = tags
-
-      if @object.update_attributes properties: props
+      if @object.update_attributes properties: tags
+        @saved_tags = true
+        render
       else
         self.render_error status: 422
       end