## Problem statement Some people (like myself) greatly prefer using all camelCase in JS and all snake_case in Ruby. Inertia doesn’t support this paradigm by default, causing the developer to use one casing scheme in both enviroments. ## Proposed fix Maybe Inertia could add a configuration option for a prop transformer - a lambda that runs before Inertia renders the response to the DOM. Something like this: ```ruby inertia_config( prop_transformer: ->(props:) do props.deep_transform_keys! { |key| key.to_s.camelize(:lower) } end ) ``` This is just an example - other considerations may need to be made for the other data processed by `InertiaRails::Renderer`. Note that this doesn’t handle transforming the props coming into Rails and I’m not sure if it should - I’m on the fence. ## Workaround This is what I’ve been using for a few weeks with good success. It may not cover all cases, but it’s been working for me: ```ruby # config/initializers/inertia_rails.rb # [Other config] module InertiaRails class CustomRenderer < InertiaRails::Renderer private def deep_transform_props(props, parent_path = []) super.deep_transform_keys! { |key| key.to_s.camelize(:lower) } end end end # This is needed to transform props keys to camelCase which is a personal # preference when consuming Inertia props in Vue components. ActionController::Renderers.add(:inertia) do |component, options| InertiaRails::CustomRenderer.new( component, self, request, response, method(:render), props: options[:props], view_data: options[:view_data], deep_merge: options[:deep_merge], encrypt_history: options[:encrypt_history], clear_history: options[:clear_history] ).render end ``` Then, to transform props coming _into_ Rails, I use this `before_action` globally via `ApplicationController`: ```ruby before_action :underscore_params # … private def underscore_params params.deep_transform_keys! { |key| key.to_s.underscore } end ```