module ActiveModelSerializers::KeyTransform
def dash(value)
- See: {https://github.com/rails/rails/blob/master/activesupport/lib/active_support/inflector/methods.rb#L185-L187 - ActiveSupport::Inflector.dasherize}
def dash(value) case value when Hash then value.deep_transform_keys! { |key| dash(key) } when Symbol then dash(value.to_s).to_sym when String then value.underscore.dasherize else value end end