bldr
bldr copied to clipboard
attribute option to indicate if a blank values' key should be included in the output
Often times, when an attribute has a nil/null value, we don't want to include the key at all in response. An option to the attribute
method like :include_blank => false
would be helpful, as we run into this problem quite a bit. Of course, the default would remain true.
Is there a global setting as well?
Would prefer something a little more semantic, like :include_blank_attributes
There is not currently, and I wasn't envisioning one -- it seems too implementation specific to be useful at a global level, though I guess it wouldn't hurt to have one...
Sorry, last arg was from an object/collection standpoint.
Would prefer something a little more semantic, like :include_blank_attributes
If this were an option passed to the attribute
method, I think :include_blank_attributes
would be a little redundant.
So maybe you're right, as a start just add the include_blank => true and we can add options higher up the stack if a general control of objects is necessary.
Sounds good. This should be pretty trivial to implement.