mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
Move from select * to select tablename.* to avoid clobbering IDs. Closes #8889 [dasil003]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7167 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
@@ -53,6 +53,7 @@ module ActiveRecord
|
||||
options[:conditions] = conditions
|
||||
options[:joins] = @join_sql
|
||||
options[:readonly] = finding_with_ambigious_select?(options[:select])
|
||||
options[:select] ||= '*'
|
||||
|
||||
if options[:order] && @reflection.options[:order]
|
||||
options[:order] = "#{options[:order]}, #{@reflection.options[:order]}"
|
||||
|
||||
@@ -1109,7 +1109,7 @@ module ActiveRecord #:nodoc:
|
||||
|
||||
def construct_finder_sql(options)
|
||||
scope = scope(:find)
|
||||
sql = "SELECT #{(scope && scope[:select]) || options[:select] || '*'} "
|
||||
sql = "SELECT #{(scope && scope[:select]) || options[:select] || (options[:joins] && table_name + '.*') || '*'} "
|
||||
sql << "FROM #{(scope && scope[:from]) || options[:from] || table_name} "
|
||||
|
||||
add_joins!(sql, options, scope)
|
||||
|
||||
Reference in New Issue
Block a user