aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/core_ext/array/conversions.rb
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2008-11-23 14:07:43 -0800
committerJeremy Kemper <jeremy@bitsweat.net>2008-11-23 15:05:57 -0800
commit6de241be8134a2b25ef17a5418db0348df07423c (patch)
treec1e05b34e527e8e3596ba3637212092c36dc8f47 /activesupport/lib/active_support/core_ext/array/conversions.rb
parent31ce92f7b5784bc5b6a441e88cd734c7b8b1c58f (diff)
downloadrails-6de241be8134a2b25ef17a5418db0348df07423c.tar.gz
rails-6de241be8134a2b25ef17a5418db0348df07423c.tar.bz2
rails-6de241be8134a2b25ef17a5418db0348df07423c.zip
Lazy-require builder lib
Diffstat (limited to 'activesupport/lib/active_support/core_ext/array/conversions.rb')
-rw-r--r--activesupport/lib/active_support/core_ext/array/conversions.rb3
1 files changed, 1 insertions, 2 deletions
diff --git a/activesupport/lib/active_support/core_ext/array/conversions.rb b/activesupport/lib/active_support/core_ext/array/conversions.rb
index cf3e03f62c..f0d6591135 100644
--- a/activesupport/lib/active_support/core_ext/array/conversions.rb
+++ b/activesupport/lib/active_support/core_ext/array/conversions.rb
@@ -1,5 +1,3 @@
-require 'builder'
-
module ActiveSupport #:nodoc:
module CoreExtensions #:nodoc:
module Array #:nodoc:
@@ -149,6 +147,7 @@ module ActiveSupport #:nodoc:
#
def to_xml(options = {})
raise "Not all elements respond to to_xml" unless all? { |e| e.respond_to? :to_xml }
+ require 'builder' unless defined?(Builder)
options[:root] ||= all? { |e| e.is_a?(first.class) && first.class.to_s != "Hash" } ? first.class.to_s.underscore.pluralize : "records"
options[:children] ||= options[:root].singularize