jimweirich / builder

Provide a simple way to create XML markup and data structures.
http://builder.rubyforge.org
MIT License
362 stars 105 forks source link

Add option to make xml.tag! handle nil values like rails ActiveRecord::Base#to_xml #33

Closed hderms closed 11 years ago

hderms commented 11 years ago

Nil values are handled differently in this gem versus rendering in the rails controller like:

render xml: @object

I think it would be nice if there was some way of instructing Builder to do something similar. More specifically, instead of a tag (foo) with a nil value being rendered like

<foo />

We could get something like:

<foo nil="true"/>

Having the option of representing nil values explicitly, without the user having to do the checks themselves would be nice.

jimweirich commented 11 years ago

Resolved in issue #34.