diff options
-rw-r--r-- | activemodel/lib/active_model/serializers/xml.rb | 2 | ||||
-rw-r--r-- | activeresource/test/cases/base_test.rb | 6 |
2 files changed, 7 insertions, 1 deletions
diff --git a/activemodel/lib/active_model/serializers/xml.rb b/activemodel/lib/active_model/serializers/xml.rb index 16ab8e7928..e89385e7e5 100644 --- a/activemodel/lib/active_model/serializers/xml.rb +++ b/activemodel/lib/active_model/serializers/xml.rb @@ -17,7 +17,7 @@ module ActiveModel def initialize(name, serializable, raw_value=nil) @name, @serializable = name, serializable - @value = value || @serializable.send(name) + @value = raw_value || @serializable.send(name) @type = compute_type end diff --git a/activeresource/test/cases/base_test.rb b/activeresource/test/cases/base_test.rb index 91b375681b..77135be146 100644 --- a/activeresource/test/cases/base_test.rb +++ b/activeresource/test/cases/base_test.rb @@ -1041,6 +1041,12 @@ class BaseTest < Test::Unit::TestCase ensure Person.element_name = old_elem_name end + + def test_to_xml_with_private_method_name_as_attribute + assert_nothing_raised(ArgumentError) { + Customer.new(:test => true).to_xml + } + end def test_to_json Person.include_root_in_json = true |