From b00c69cd1f0b0143ad8e6b92c982c106845583c7 Mon Sep 17 00:00:00 2001 From: Justin Date: Tue, 19 Apr 2016 09:49:55 -0300 Subject: [PATCH] Change the Hash.to_xml with a lamda example Update 'foo'.to_xml(lambda { |options, key| options[:builder].b(key) }) to {foo: lambda { |options, key| options[:builder].b(key) }}.to_xml --- activesupport/lib/active_support/core_ext/hash/conversions.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/activesupport/lib/active_support/core_ext/hash/conversions.rb b/activesupport/lib/active_support/core_ext/hash/conversions.rb index 6741e732f0..dd5ebe6d8d 100644 --- a/activesupport/lib/active_support/core_ext/hash/conversions.rb +++ b/activesupport/lib/active_support/core_ext/hash/conversions.rb @@ -31,7 +31,7 @@ class Hash # with +key+ as :root, and +key+ singularized as second argument. The # callable can add nodes by using options[:builder]. # - # 'foo'.to_xml(lambda { |options, key| options[:builder].b(key) }) + # {foo: lambda { |options, key| options[:builder].b(key) }}.to_xml # # => "foo" # # * If +value+ responds to +to_xml+ the method is invoked with +key+ as :root.