method
construct_finder_sql_with_included_associations
v1.0.0 -
Show latest stable
- Class:
ActiveRecord::Associations::ClassMethods
construct_finder_sql_with_included_associations(options, schema_abbreviations, reflections)private
No documentation available.
# File activerecord/lib/active_record/associations.rb, line 947
def construct_finder_sql_with_included_associations(options, schema_abbreviations, reflections)
sql = "SELECT #{column_aliases(schema_abbreviations)} FROM #{table_name} "
sql << reflections.collect { |reflection| association_join(reflection) }.to_s
sql << "#{options[:joins]} " if options[:joins]
add_conditions!(sql, options[:conditions])
add_sti_conditions!(sql, reflections)
add_limited_ids_condition!(sql, options) if !using_limitable_reflections?(reflections) && options[:limit]
sql << "ORDER BY #{options[:order]} " if options[:order]
add_limit!(sql, options) if using_limitable_reflections?(reflections)
return sanitize_sql(sql)
end