This project is archived and is in readonly mode.
Changeset [7bf9bf3dd6b4c4d78214917f0877536d222098bb] by John Small
May 10th, 2009 @ 02:09 AM
Add configuration options for :dasherize and :camelize calls to Hash#to_xml
People using ActiveResource & REST to integrate with other systems need to be able to control the default dasherize behavior of Hash.to_xml. Currently there is no test for a default value, but existing code asssumes it's true. This patch adds tests for the default value and adds mattr_accessor to ActiveSupport for :dasherize_xml and :camelize_xml. These module attributes set the defaults for :dasherize and :camelize in rename_keys inside Hash#to_xml. The tests have been changed to separate out the testing of the parameter options for :camelize and :dasherize so that we only test one thing at a time. We also test default values for :camelize_xml and :dasherize_xml.
The module attribute dasherize_xml is set to true in this patch to maintain existing code. But at some point in the future it should be set to false because Hash#to_xml probably should not set underscores to dashes by default.
Changed documentation on ActiveResource#to_xml to correctly describe the behaviour of Hash#to_xml. The previous documentation said that the default for :dasherize was false, in fact it was and still is true, but we now have a way to change the default. I've also added documentation for the :camelize option.
Signed-off-by: Michael Koziarski michael@koziarski.com http://github.com/rails/rails/co...
Committed by John Small
- M activeresource/lib/active_resource/base.rb
- M activesupport/lib/active_support/core_ext/hash/conversions.rb
- M activesupport/test/core_ext/hash_ext_test.rb
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>