diff options
author | Santiago Pastorino <santiago@wyeworks.com> | 2012-10-05 12:07:16 -0300 |
---|---|---|
committer | Santiago Pastorino <santiago@wyeworks.com> | 2012-10-05 12:07:16 -0300 |
commit | a0613ad8a9773c76a9b0a256f7099fde35823674 (patch) | |
tree | ac866e7a5c8fa4c15f025759dd0ed1dccb54d311 /activerecord/lib/active_record/relation | |
parent | abf8de85519141496a6773310964ec03f6106f3f (diff) | |
download | rails-a0613ad8a9773c76a9b0a256f7099fde35823674.tar.gz rails-a0613ad8a9773c76a9b0a256f7099fde35823674.tar.bz2 rails-a0613ad8a9773c76a9b0a256f7099fde35823674.zip |
Revert "Use flat_map { } instead of map {}.flatten"
This reverts commit abf8de85519141496a6773310964ec03f6106f3f.
We should take a deeper look to those cases flat_map doesn't do deep
flattening.
irb(main):002:0> [[[1,3], [1,2]]].map{|i| i}.flatten
=> [1, 3, 1, 2]
irb(main):003:0> [[[1,3], [1,2]]].flat_map{|i| i}
=> [[1, 3], [1, 2]]
Diffstat (limited to 'activerecord/lib/active_record/relation')
-rw-r--r-- | activerecord/lib/active_record/relation/query_methods.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/relation/query_methods.rb b/activerecord/lib/active_record/relation/query_methods.rb index 21c2b02b7e..3c59bd8a68 100644 --- a/activerecord/lib/active_record/relation/query_methods.rb +++ b/activerecord/lib/active_record/relation/query_methods.rb @@ -782,7 +782,7 @@ module ActiveRecord def reverse_sql_order(order_query) order_query = ["#{quoted_table_name}.#{quoted_primary_key} ASC"] if order_query.empty? - order_query.flat_map do |o| + order_query.map do |o| case o when Arel::Nodes::Ordering o.reverse @@ -794,7 +794,7 @@ module ActiveRecord else o end - end + end.flatten end def array_of_strings?(o) |