Rohde-Schwarz / sparrow

Define your request and response JSON format with a Rack middleware!
MIT License
13 stars 6 forks source link

This gem is no longer necessary #27

Closed vassilevsky closed 3 years ago

vassilevsky commented 6 years ago

Hi :)

I just wanted to share a solution that we started using in favor of this gem:

class ApplicationController < ActionController::API

  before_action :convert_parameters_name_to_snake_case

  private

  def convert_parameters_name_to_snake_case
    self.params = ActionController::Parameters.new(params.to_unsafe_hash.deep_transform_keys(&:underscore))
  end

end

It's sufficient for our needs.

Maybe someone will find it helpful too.