method
construct_finder_sql_for_association_limiting
construct_finder_sql_for_association_limiting(options, join_dependency)
private
Hide source
# File activerecord/lib/active_record/associations.rb, line 1177 def construct_finder_sql_for_association_limiting(options, join_dependency) scope = scope(:find) sql = "SELECT " sql << "DISTINCT #{table_name}." if include_eager_conditions?(options) || include_eager_order?(options) sql << primary_key sql << ", #{options[:order].split(',').collect { |s| s.split.first } * ', '}" if options[:order] && (include_eager_conditions?(options) || include_eager_order?(options)) sql << " FROM #{table_name} " if include_eager_conditions?(options) || include_eager_order?(options) sql << join_dependency.join_associations.collect{|join| join.association_join }.join add_joins!(sql, options, scope) end add_conditions!(sql, options[:conditions], scope) sql << "ORDER BY #{options[:order]} " if options[:order] add_limit!(sql, options, scope) return sanitize_sql(sql) end