# To\_xml output hyphen instead of underscore update?

**URL:** <https://www.ruby-forum.com/t/to-xml-output-hyphen-instead-of-underscore-update/73926>\
**Category:** Rails\
**Created:** [October 28, 2006, 1:52am UTC](https://www.ruby-forum.com/t/to-xml-output-hyphen-instead-of-underscore-update/73926 "2006-10-28T01:52:47Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![joe](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/b9e5f3/32.png) [@joe](https://www.ruby-forum.com/u/joe)\
**Post date:** [October 28, 2006, 1:52am UTC](https://www.ruby-forum.com/t/to-xml-output-hyphen-instead-of-underscore-update/73926/1 "2006-10-28T01:52:47Z")

</div>

I found this solution:

[http://wrath.rubyonrails.org/pipermail/rails/2006-July/057420.html](http://wrath.rubyonrails.org/pipermail/rails/2006-July/057420.html)

Are there any better ideas out there?

---

<div class="post-metadata">

**Author:** ![joe](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/b9e5f3/32.png) [@joe](https://www.ruby-forum.com/u/joe)\
**Post date:** [October 28, 2006, 2:04am UTC](https://www.ruby-forum.com/t/to-xml-output-hyphen-instead-of-underscore-update/73926/2 "2006-10-28T02:04:48Z")

</div>

On 10/27/06, Joe [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I found this solution:
> 
> [http://wrath.rubyonrails.org/pipermail/rails/2006-July/057420.html](http://wrath.rubyonrails.org/pipermail/rails/2006-July/057420.html)
> 
> Are there any better ideas out there?

I’m unsure of the problem as stated, but to\_xml takes a boolean  
:dasherize  
option.

jeremy

---

<div class="post-metadata">

**Author:** ![joe](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/b9e5f3/32.png) [@joe](https://www.ruby-forum.com/u/joe)\
**Post date:** [October 28, 2006, 2:06am UTC](https://www.ruby-forum.com/t/to-xml-output-hyphen-instead-of-underscore-update/73926/3 "2006-10-28T02:06:48Z")

</div>

Actually in a moment of simplicity I just tried to\_xml.underscore and  
it worked.

---

<div class="post-metadata">

**Author:** ![joe](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/b9e5f3/32.png) [@joe](https://www.ruby-forum.com/u/joe)\
**Post date:** [October 28, 2006, 2:20am UTC](https://www.ruby-forum.com/t/to-xml-output-hyphen-instead-of-underscore-update/73926/4 "2006-10-28T02:20:48Z")

</div>

On 10/27/06, Joe [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> This didn’t seem to work for me (1.1.6):
> 
> render :xml=\>@items.to\_xml(:dasherize =\>false)

Try it on edge (soon to be 1.2).

jeremy

---

<div class="post-metadata">

**Author:** ![joe](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/b9e5f3/32.png) [@joe](https://www.ruby-forum.com/u/joe)\
**Post date:** [October 28, 2006, 2:10am UTC](https://www.ruby-forum.com/t/to-xml-output-hyphen-instead-of-underscore-update/73926/5 "2006-10-28T02:10:48Z")

</div>

This didn’t seem to work for me (1.1.6):

render :xml=\>@items.to\_xml(:dasherize =\>false)
