At work we use ActiveModel::Serializer to serialize ActiveRecord objects into JSON:API-like responses for our APIs. The problem is that ActiveModel::Serializer is clever enough to dasherize our hash keys (so they can be accessed as properties instead of  brackets syntax) and our hash keys are actually real keys that we have to serve untouched.
Luckily the solution is more than simple. Insert the following setting into AMS initializer and you are done:
ActiveModelSerializers.config.key_transform = :unaltered
:unaltered have also the added benefit of being faster as it does not modify anything. I believe it should be default, perhaps it was, I am on version
Before you leave…
Would you like to learn how to deploy your own Ruby on Rails applications? I am writing a book for people like you.