diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2005-04-14 04:07:26 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2005-04-14 04:07:26 +0000 |
commit | cef09015c7264adf082bff01a220a0b66a83dd90 (patch) | |
tree | 1c37775c7c0aad41145a77e915ebfb4fb313a7bc | |
parent | ff1db4de5f291baef70ba637101bed35d79c4b86 (diff) | |
download | rails-cef09015c7264adf082bff01a220a0b66a83dd90.tar.gz rails-cef09015c7264adf082bff01a220a0b66a83dd90.tar.bz2 rails-cef09015c7264adf082bff01a220a0b66a83dd90.zip |
Order by is no longer a guarentee
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1164 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
-rw-r--r-- | activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb b/activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb index af93b5c152..15211c2223 100644 --- a/activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb +++ b/activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb @@ -66,7 +66,7 @@ module ActiveRecord # 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 |