Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
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...
commit cef09015c7264adf082bff01a220a0b66a83dd90 1 parent ff1db4d
@dhh dhh authored
View
2  activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.