Merge branch 'master' into 3219-further-docker-improvements
[arvados.git] / apps / workbench / app / controllers / application_controller.rb
index f01c589d1e11f35a5d49c1bc3e77223e9e44464c..f739ee1046bb569f6e55bd4aef72cbd786d7fc26 100644 (file)
@@ -132,12 +132,15 @@ class ApplicationController < ActionController::Base
   end
 
   helper_method :next_page_offset
-  def next_page_offset
-    if @objects.respond_to?(:result_offset) and
-        @objects.respond_to?(:result_limit) and
-        @objects.respond_to?(:items_available)
-      next_offset = @objects.result_offset + @objects.result_limit
-      if next_offset < @objects.items_available
+  def next_page_offset objects=nil
+    if !objects
+      objects = @objects
+    end
+    if objects.respond_to?(:result_offset) and
+        objects.respond_to?(:result_limit) and
+        objects.respond_to?(:items_available)
+      next_offset = objects.result_offset + objects.result_limit
+      if next_offset < objects.items_available
         next_offset
       else
         nil
@@ -258,7 +261,7 @@ class ApplicationController < ActionController::Base
       if @object.name and @object.name != ''
         @object.name = "Copy of #{@object.name}"
       else
-        @object.name = "Copy of unnamed #{@object.class_for_display.downcase}"
+        @object.name = ""
       end
     end
     @object.save!
@@ -356,7 +359,10 @@ class ApplicationController < ActionController::Base
       else
         @object = model_class.find(params[:uuid])
       end
-    rescue ArvadosApiClient::NotFoundException => error
+    rescue ArvadosApiClient::NotFoundException, RuntimeError => error
+      if error.is_a?(RuntimeError) and (error.message !~ /^argument to find\(/)
+        raise
+      end
       render_not_found(error)
       return false
     end