method
construct_finder_sql
v1.1.6 -
Show latest stable
- Class:
ActiveRecord::Base
construct_finder_sql(options)private
No documentation available.
# File activerecord/lib/active_record/base.rb, line 1006
def construct_finder_sql(options)
scope = scope(:find)
sql = "SELECT #{(scope && scope[:select]) || options[:select] || '*'} "
sql << "FROM #{(scope && scope[:from]) || options[:from] || table_name} "
add_joins!(sql, options, scope)
add_conditions!(sql, options[:conditions], scope)
sql << " GROUP BY #{options[:group]} " if options[:group]
sql << " ORDER BY #{options[:order]} " if options[:order]
add_limit!(sql, options, scope)
sql
end