From aa40543022303d8a1b695e73ed71406c0da15bde Mon Sep 17 00:00:00 2001 From: Franck Verrot Date: Thu, 18 Nov 2010 09:01:45 +0100 Subject: Provide test for #4840: to_xml doesn't work in such case: Event.select('title as t').to_xml --- activerecord/test/cases/xml_serialization_test.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/activerecord/test/cases/xml_serialization_test.rb b/activerecord/test/cases/xml_serialization_test.rb index 2003e25e35..a6074b23e7 100644 --- a/activerecord/test/cases/xml_serialization_test.rb +++ b/activerecord/test/cases/xml_serialization_test.rb @@ -262,4 +262,10 @@ class DatabaseConnectedXmlSerializationTest < ActiveRecord::TestCase assert array.include? 'github' end + def test_should_support_aliased_attributes + xml = Author.select("name as firstname").to_xml + array = Hash.from_xml(xml)['authors'] + assert_equal array.size, array.select { |author| author.has_key? 'firstname' }.size + end + end -- cgit v1.2.3