From a0613ad8a9773c76a9b0a256f7099fde35823674 Mon Sep 17 00:00:00 2001 From: Santiago Pastorino Date: Fri, 5 Oct 2012 12:07:16 -0300 Subject: 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]] --- guides/rails_guides/helpers.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'guides/rails_guides') diff --git a/guides/rails_guides/helpers.rb b/guides/rails_guides/helpers.rb index c8ab9e4536..e6ef656474 100644 --- a/guides/rails_guides/helpers.rb +++ b/guides/rails_guides/helpers.rb @@ -17,7 +17,7 @@ module RailsGuides end def documents_flat - documents_by_section.flat_map {|section| section['documents']} + documents_by_section.map {|section| section['documents']}.flatten end def finished_documents(documents) -- cgit v1.2.3