Class: ActiveRecord::Relation

Inherits:
Object
  • Object
show all
Defined in:
ext/active_record/relation.rb

Instance Method Summary collapse

Instance Method Details

#to_sarObject



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

def to_sar
  @to_sar ||= begin
    if eager_loading?
      apply_join_dependency do |relation, join_dependency|
        relation = join_dependency.apply_column_aliases(relation)
        relation.to_sar
      end
    else
      conn = klass.connection
      conn.unprepared_statement { conn.to_sar(arel) }
    end
  end
end