aboutsummaryrefslogtreecommitdiffstats
path: root/guides
diff options
context:
space:
mode:
Diffstat (limited to 'guides')
-rw-r--r--guides/rails_guides/helpers.rb2
-rw-r--r--guides/source/active_support_core_extensions.md6
2 files changed, 4 insertions, 4 deletions
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)
diff --git a/guides/source/active_support_core_extensions.md b/guides/source/active_support_core_extensions.md
index 1930cbe22c..2a84242b9c 100644
--- a/guides/source/active_support_core_extensions.md
+++ b/guides/source/active_support_core_extensions.md
@@ -517,7 +517,7 @@ ActionController::TestCase.class_eval do
# now redefine process and delegate to original_process
def process(action, params=nil, session=nil, flash=nil, http_method='GET')
- params = Hash[*params.flat_map {|k, v| [k, v.to_s]}]
+ params = Hash[*params.map {|k, v| [k, v.to_s]}.flatten]
original_process(action, params, session, flash, http_method)
end
end
@@ -530,7 +530,7 @@ That technique has a risk, it could be the case that `:original_process` was tak
```ruby
ActionController::TestCase.class_eval do
def process_with_stringified_params(...)
- params = Hash[*params.flat_map {|k, v| [k, v.to_s]}]
+ params = Hash[*params.map {|k, v| [k, v.to_s]}.flatten]
process_without_stringified_params(action, params, session, flash, http_method)
end
alias_method :process_without_stringified_params, :process
@@ -543,7 +543,7 @@ The method `alias_method_chain` provides a shortcut for that pattern:
```ruby
ActionController::TestCase.class_eval do
def process_with_stringified_params(...)
- params = Hash[*params.flat_map {|k, v| [k, v.to_s]}]
+ params = Hash[*params.map {|k, v| [k, v.to_s]}.flatten]
process_without_stringified_params(action, params, session, flash, http_method)
end
alias_method_chain :process, :stringified_params