Class: ActiveRecord::Relation

Inherits:
Object
  • Object
show all
Defined in:
lib/comma/relation.rb

Instance Method Summary collapse

Instance Method Details

#to_comma(style = :default) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/comma/relation.rb', line 5

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