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
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!
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