diff options
author | Emilio Tagua <miloops@gmail.com> | 2009-06-10 19:46:35 -0300 |
---|---|---|
committer | Emilio Tagua <miloops@gmail.com> | 2009-06-10 19:46:35 -0300 |
commit | af9f9dd02c5539df0f05cb92e0799dc9e0bc8d46 (patch) | |
tree | 8366179d7911c2d5a453524f0820304acd69c1c9 | |
parent | 0587462050ff6f58b277246501d504e6780b481e (diff) | |
download | rails-af9f9dd02c5539df0f05cb92e0799dc9e0bc8d46.tar.gz rails-af9f9dd02c5539df0f05cb92e0799dc9e0bc8d46.tar.bz2 rails-af9f9dd02c5539df0f05cb92e0799dc9e0bc8d46.zip |
Use array of orders instead of string concatenation
-rwxr-xr-x | activerecord/lib/active_record/base.rb | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index adc7f5335d..df0cce4bf3 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -1750,17 +1750,15 @@ module ActiveRecord #:nodoc: end def construct_order(order, scope = :auto) - sql = '' + orders = [] scoped_order = scope[:order] if scope if order - sql << order.to_s - if scoped_order && scoped_order != order - sql << ", #{scoped_order}" - end + orders << order + orders << scoped_order if scoped_order && scoped_order != order else - sql << scoped_order.to_s if scoped_order + orders << scoped_order if scoped_order end - sql + orders end def construct_limit(options, scope = :auto) |