Add and remove collection tags with ajax.
[arvados.git] / apps / workbench / app / controllers / application_controller.rb
index 02ebc8b3a198090c83fe98e5c3f99f18c0993c9d..e94428e92dca51ad00e415f38dac8ff69c35c4ef 100644 (file)
@@ -107,9 +107,10 @@ class ApplicationController < ActionController::Base
   end
 
   def create
-    @object ||= model_class.new params[model_class.to_s.singularize.to_sym]
+    @object ||= model_class.new params[model_class.to_s.underscore.singularize]
     @object.save!
     respond_to do |f|
+      f.json { render json: @object }
       f.html {
         redirect_to(params[:return_to] || @object)
       }
@@ -120,6 +121,7 @@ class ApplicationController < ActionController::Base
   def destroy
     if @object.destroy
       respond_to do |f|
+        f.json { render json: @object }
         f.html {
           redirect_to(params[:return_to] || :back)
         }