fix response type for #index
[arvados.git] / services / api / app / controllers / application_controller.rb
index d6efb015cf9074d4771b4f016fe52f4bd7635271..c80b578adaa69efe1584caeece5fb225b4608d65 100644 (file)
@@ -37,8 +37,11 @@ class ApplicationController < ActionController::Base
   end
 
   def update
-    @object.update_attributes resource_attrs
-    show
+    if @object.update_attributes resource_attrs
+      show
+    else
+      render json: { errors: @object.errors.full_messages }, status: 422
+    end
   end
 
   def destroy