[Rails] is it possible to make to_xml use underscore instead of dash?

Peter Armstrong peterarmstrong at gmail.com
Mon Jul 31 07:59:53 GMT 2006


Hi all,

I am getting ActiveRecord to produce XML with

      render :xml => @user.to_xml

However, on the client end it is a bit annoying for me to deal with
attributes like first-name.  I would much rather have first_name.

Is there any way for me to turn off the behavior of converting _ to -?
 This seems to be done by a call to dasherize inside the to_xml of
ActiveSupport::CoreExtensions::Array::Conversions, so I'm a bit out of
my depth...

Thanks,
Peter Armstrong


More information about the Rails mailing list