Adds the ability to define hidden_attributes that are not rendered by default. For example, say you have a UserSerializer with a home_address attribute that you don't want to remember to exclude every time you use that serializer. Just define your serializer with hidden_attributes :home_address and then add the expose: :home_address option in the places where you do want home_address displayed.
Added hidden_attributes method for attributes that require explicit e…
What is the advantage of doing this, when attributes are already a white list?
It avoids defining a new class to display select attributes in exceptional cases.
We implemented same behavior in our app a bit different:
default_keys = keys - hidden_attributes
keys & @only
default_keys + @expose
This is out of date, and I'm still not convinced it's worth it. Thank you!