Mutli word model fields not serialized properly


Hi All

I’m seeing some odd behavior with custom serializer code that I wrote.

I have a field in an Asset model called ‘marketName’. My Rails backend expects this field to be called ‘market_name’. I’ve extended the ActiveModelSerializer and have overridden the ‘extractSingle’ and ‘serialize’ methods.

The odd thing is this - for all the other fields in my Asset model that are not made up of multiple words - the serialization code that I’ve written works great. No issues. However - for any field containing multiple words - the serialization doesn’t work completely, in that while it saves the Asset when created - it doesn’t correctly populate the Asset model’s ‘marketName’ field (and any other field that is made up of multiple words).

For example if I examine the ‘marketName’ field in the data inspector it appears as ‘{}’. If I change the name of any multi word field in my Asset model to be singular (aka change ‘marketName’ to ‘name’) and update the serialization code accordingly - everthing works great.

Any idea what’s going on ?

Thanks Dave