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 1158 def construct_finder_sql_for_association_limiting(options, join_dependency) scope = scope(:find) #sql = "SELECT DISTINCT #{table_name}.#{primary_key} FROM #{table_name} " sql = "SELECT " sql << "DISTINCT #{table_name}." if include_eager_conditions?(options) || include_eager_order?(options) sql << "#{primary_key} 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


