6074: Clear any existing ActiveRecord select() before adding our own,
[arvados.git] / services / api / app / controllers / application_controller.rb
index 6810d91d4cd6c235751365b1e6d1856a5f6a19b8..3a3f6d334589058b3e3af1c0dc13c97cfbf4bff3 100644 (file)
@@ -301,8 +301,9 @@ class ApplicationController < ActionController::Base
     return if limit_columns.empty?
     model_class.transaction do
       limit_query = @objects.
+        except(:select).
         select("(%s) as read_length" %
-               limit_columns.map { |s| "length(#{s})" }.join(" + "))
+               limit_columns.map { |s| "octet_length(#{s})" }.join(" + "))
       new_limit = 0
       read_total = 0
       limit_query.find_each do |record|