Permalink
Browse files

Order by is no longer a guarentee

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1164 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
dhh committed Apr 14, 2005
1 parent ff1db4d commit cef09015c7264adf082bff01a220a0b66a83dd90
@@ -66,7 +66,7 @@ def find(*args)
# Otherwise, construct a query.
else
ids_list = ids.map { |id| @owner.send(:quote, id) }.join(',')
- records = find_target(@finder_sql.sub(/ORDER BY/, "AND j.#{@association_foreign_key} IN (#{ids_list}) ORDER BY"))
+ records = find_target(@finder_sql.sub(/(ORDER BY|$)/, "AND j.#{@association_foreign_key} IN (#{ids_list}) \\1"))
if records.size == ids.size
if ids.size == 1 and !expects_array
records.first

0 comments on commit cef0901

Please sign in to comment.