I have a unit test that demonstrates some inconsistent behavior with a Hash being converted to XML with the :root option. Sometimes it works fine: Hash.new.to_xml(:root => ''test'') "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<test>\n</test>\n" But sometimes I get an argument error: Hash.new.to_xml(:root => ''test'') ArgumentError Exception: wrong number of arguments (1 for 0) I thought it may be a bug related to the version of Rails, but I have tried several versions and have the same problem. Anyone have any ideas of where I should be looking? Thanks, Tom -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 11 Feb 2010, at 15:43, TomRossi7 wrote:> I have a unit test that demonstrates some inconsistent behavior with a > Hash being converted to XML with the :root option. Sometimes it works > fine: > > Hash.new.to_xml(:root => ''test'') > "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<test>\n</test>\n" > > But sometimes I get an argument error: > > Hash.new.to_xml(:root => ''test'') > ArgumentError Exception: wrong number of arguments (1 for 0) > > I thought it may be a bug related to the version of Rails, but I have > tried several versions and have the same problem. Anyone have any > ideas of where I should be looking?Sounds to me you are including some other class that has the to_xml method somewhere. It can be either something an outdated plugin uses or some code in your lib/ folder or part of a gem. That''s why it only happens "sometimes", it only happens in classes that have the non- Rails to_xml method loaded. Best regards Peter De Berdt -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Yep! I found an old plugin that was actually overwriting the Hash#to_xml method! Thanks! --Tom On Feb 11, 10:23 am, Peter De Berdt <peter.de.be...-LPO8gxj9N8aZIoH1IeqzKA@public.gmane.org> wrote:> On 11 Feb 2010, at 15:43, TomRossi7 wrote: > > > I have a unit test that demonstrates some inconsistent behavior with a > > Hash being converted to XML with the :root option. Sometimes it works > > fine: > > > Hash.new.to_xml(:root => ''test'') > > "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<test>\n</test>\n" > > > But sometimes I get an argument error: > > > Hash.new.to_xml(:root => ''test'') > > ArgumentError Exception: wrong number of arguments (1 for 0) > > > I thought it may be a bug related to the version of Rails, but I have > > tried several versions and have the same problem. Anyone have any > > ideas of where I should be looking? > > Sounds to me you are including some other class that has the to_xml > method somewhere. It can be either something an outdated plugin uses > or some code in your lib/ folder or part of a gem. That''s why it only > happens "sometimes", it only happens in classes that have the non- > Rails to_xml method loaded. > > Best regards > > Peter De Berdt-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.