From 0bf3baa6b3d216c6340f8d3b5d0a3ebc093e969a Mon Sep 17 00:00:00 2001 From: Neeraj Singh Date: Wed, 23 Jun 2010 11:54:38 -0400 Subject: [PATCH] adding fix for to_xml for ActiveRecord relation object MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: José Valim --- activerecord/lib/active_record/relation.rb | 2 +- activerecord/test/cases/relations_test.rb | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/activerecord/lib/active_record/relation.rb b/activerecord/lib/active_record/relation.rb index a342b1fe6f..a51b317dc3 100644 --- a/activerecord/lib/active_record/relation.rb +++ b/activerecord/lib/active_record/relation.rb @@ -10,7 +10,7 @@ module ActiveRecord include FinderMethods, Calculations, SpawnMethods, QueryMethods, Batches - delegate :to_json, :to_yaml, :length, :collect, :map, :each, :all?, :include?, :to => :to_a + delegate :to_xml, :to_json, :to_yaml, :length, :collect, :map, :each, :all?, :include?, :to => :to_a delegate :insert, :to => :arel attr_reader :table, :klass diff --git a/activerecord/test/cases/relations_test.rb b/activerecord/test/cases/relations_test.rb index f2216a1923..4316aa98d4 100644 --- a/activerecord/test/cases/relations_test.rb +++ b/activerecord/test/cases/relations_test.rb @@ -39,6 +39,11 @@ class RelationTest < ActiveRecord::TestCase assert_nothing_raised { Bird.scoped.all.to_yaml } end + def test_to_xml + assert_nothing_raised { Bird.scoped.to_xml } + assert_nothing_raised { Bird.scoped.all.to_xml } + end + def test_scoped_all topics = Topic.scoped.all assert_kind_of Array, topics