diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2005-04-19 05:24:50 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2005-04-19 05:24:50 +0000 |
commit | cdf88b7b04a1d9a928410b1c90a8f1c1bc053c89 (patch) | |
tree | 3bb85ab0c92fa2c269ea8cdc395dd17cb420a95d /activerecord/lib | |
parent | 928206259bfcceb282a4e2aa6994ecdb216b22c3 (diff) | |
download | rails-cdf88b7b04a1d9a928410b1c90a8f1c1bc053c89.tar.gz rails-cdf88b7b04a1d9a928410b1c90a8f1c1bc053c89.tar.bz2 rails-cdf88b7b04a1d9a928410b1c90a8f1c1bc053c89.zip |
Fixed stray comma when using eager loading and ordering together from has_many associations #1143
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1220 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/associations/has_many_association.rb | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/associations/has_many_association.rb b/activerecord/lib/active_record/associations/has_many_association.rb index a775f438f3..5b0ac25d17 100644 --- a/activerecord/lib/active_record/associations/has_many_association.rb +++ b/activerecord/lib/active_record/associations/has_many_association.rb @@ -67,7 +67,13 @@ module ActiveRecord end else options[:conditions] = @finder_sql + (options[:conditions] ? " AND #{options[:conditions]}" : "") - options[:order] = options[:order] ? "#{options[:order]}, #{@options[:order]}" : @options[:order] + + if options[:order] && @options[:order] + options[:order] = "#{options[:order]}, #{@options[:order]}" + elsif @options[:order] + options[:order] = @options[:order] + end + @association_class.find(args.size == 1 ? args.first : args, options) end end |