You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#652 introduced camelize_keys, which is great especially if you expose rabl results to react component for instance. The problem is that it doesn't camelize nested keys.
I added failing tests
context"when keys are camelized"dosetupdoRabl.configuration.camelize_keys=truebuilder(nil,{:attributes=>[{:name=>:first_pets_name}],:node=>[{:name=>:preferences,:block=>lambda{ |u| {has_visible_profile: true}}}]})endasserts"that the key is camelized"dotopic.to_hash(User.new)end.equivalent_to({:firstPetsName=>'jack',preferences: {hasVisibleProfile: true}})teardowndoRabl.configuration.camelize_keys=falseendendcontext"when keys are camelized with upper case first letter"dosetupdoRabl.configuration.camelize_keys=:upperbuilder(nil,{:attributes=>[{:name=>:first_pets_name}],:node=>[{:name=>:preferences,:block=>lambda{ |u| {has_visible_profile: true}}}]})endasserts"that the key is camelized with upper case first letter"dotopic.to_hash(User.new)end.equivalent_to({:FirstPetsName=>'jack',Preferences: {HasVisibleProfile: true}})teardowndoRabl.configuration.camelize_keys=falseendend
I can't trace where the hash is parsed and names are set, can anyone help me out with this?
Thanks!
The text was updated successfully, but these errors were encountered:
#652 introduced camelize_keys, which is great especially if you expose rabl results to react component for instance. The problem is that it doesn't camelize nested keys.
I added failing tests
I can't trace where the hash is parsed and names are set, can anyone help me out with this?
Thanks!
The text was updated successfully, but these errors were encountered: