Sha256: 03e72e89a17828f9697158e4a73387aa564bd9aa2d8a6e5acb6e179b536a8a9a

Contents?: true

Size: 547 Bytes

Versions: 8

Compression:

Stored size: 547 Bytes

Contents

# frozen_string_literal: true

module ActiveRecord
  class Relation
    def to_comma(style = :default)
      iterator_method =
        if arel.ast.limit || !arel.ast.orders.empty?
          Rails.logger.warn { <<~WARN } if defined?(Rails)
            #to_comma is being used on a relation with limit or order clauses. Falling back to iterating with :each. This can cause performance issues.
          WARN
          :each
        else
          :find_each
        end
      Comma::Generator.new(self, style).run(iterator_method)
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
comma-4.8.0 lib/comma/relation.rb
comma-4.7.0 lib/comma/relation.rb
comma-4.6.0 lib/comma/relation.rb
comma-4.5.0 lib/comma/relation.rb
comma-4.4.0 lib/comma/relation.rb
comma-4.3.2 lib/comma/relation.rb
comma-4.3.1 lib/comma/relation.rb
comma-4.3.0 lib/comma/relation.rb