When no limit is supplied, limit number of index results to 100.
[arvados.git] / app / controllers / application_controller.rb
index d3427160cbbfd249476264441f4ec58f4a1199ee..738a07346b0008a86a8d77625e673977e88b8210 100644 (file)
@@ -77,6 +77,15 @@ class ApplicationController < ActionController::Base
           where(*conditions)
       end
     end
+    if params[:limit]
+      begin
+        @objects = @objects.limit(params[:limit].to_i)
+      rescue
+        raise "invalid argument (limit)"
+      end
+    else
+      @objects = @objects.limit(100)
+    end
     @objects.uniq!(&:id)
     if params[:eager] and params[:eager] != '0' and params[:eager] != 0 and params[:eager] != ''
       @objects.each(&:eager_load_associations)