aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
diff options
context:
space:
mode:
authorTobias Lütke <tobias.luetke@gmail.com>2007-07-09 18:13:24 +0000
committerTobias Lütke <tobias.luetke@gmail.com>2007-07-09 18:13:24 +0000
commit049b1440a392ac53a427fecd4500bb839e090be4 (patch)
tree9ae9c891f70dd7d6a6b1390a0abd3cc9ca21c396 /activerecord/test
parent124161569273e050d9e0389717cf36a491c6c119 (diff)
downloadrails-049b1440a392ac53a427fecd4500bb839e090be4.tar.gz
rails-049b1440a392ac53a427fecd4500bb839e090be4.tar.bz2
rails-049b1440a392ac53a427fecd4500bb839e090be4.zip
Include empty has_many/has_and_belongs_to_many associations as empty array tags when serializing to XML
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7169 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/test')
-rw-r--r--activerecord/test/xml_serialization_test.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/activerecord/test/xml_serialization_test.rb b/activerecord/test/xml_serialization_test.rb
index 8c59d5d26b..824f486d2e 100644
--- a/activerecord/test/xml_serialization_test.rb
+++ b/activerecord/test/xml_serialization_test.rb
@@ -162,4 +162,12 @@ class DatabaseConnectedXmlSerializationTest < Test::Unit::TestCase
assert_match %r{^ <label>.*</label>}, xml
assert_no_match %r{^ <label>}, xml
end
+
+ def test_should_include_empty_has_many_as_empty_array
+ authors(:david).posts.delete_all
+ xml = authors(:david).to_xml :include=>:posts, :indent => 0
+
+ assert_match %r{<posts type="array"></posts>}, xml
+ end
+
end \ No newline at end of file