Merge branch 'master' of git.clinicalfuture.com:arvados into 1685-api-server-redirect...
[arvados.git] / services / api / app / controllers / application_controller.rb
index 10915803370d1f38aaad956dfeebf9573a7114d9..c6e7da0e11391297513a3cf8016d1ea1196d2148 100644 (file)
@@ -83,7 +83,7 @@ class ApplicationController < ActionController::Base
     else
       errors = [e.inspect]
     end
-    status = if e.respond_to?(:http_status) ? e.http_status : 422
+    status = e.respond_to?(:http_status) ? e.http_status : 422
     render json: { errors: errors }, status: status
   end
 
@@ -328,13 +328,16 @@ class ApplicationController < ActionController::Base
 
   def render_list
     @object_list = {
-      :kind  => "arvados##{resource_name}List",
+      :kind  => "arvados##{(@response_resource_name || resource_name).camelize(:lower)}List",
       :etag => "",
       :self_link => "",
       :next_page_token => "",
       :next_link => "",
       :items => @objects.as_api_response(nil)
     }
+    if @objects.respond_to? :except
+      @object_list[:items_available] = @objects.except(:limit).count
+    end
     render json: @object_list
   end