diff options
author | Andreas Garnæs <andreas.garnaes@gmail.com> | 2010-09-02 12:35:37 +0200 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-09-02 12:55:45 +0200 |
commit | 1503e45e2e2de8314429d3e3006bd49c0c4a11d6 (patch) | |
tree | 2da2d6cc4d41e2f47730b085ce72babf40e4699a | |
parent | b8f3b262e091ad31f2aa2859e58bed541eeca8ec (diff) | |
download | rails-1503e45e2e2de8314429d3e3006bd49c0c4a11d6.tar.gz rails-1503e45e2e2de8314429d3e3006bd49c0c4a11d6.tar.bz2 rails-1503e45e2e2de8314429d3e3006bd49c0c4a11d6.zip |
ActiveModel#to_xml fix (renamed parameter).
Signed-off-by: José Valim <jose.valim@gmail.com>
-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 |