Sha256: 5be7fcbc1c5141a0f68c30941b1f28a2d66704af05fa7cc74b5b88802abd130f

Contents?: true

Size: 560 Bytes

Versions: 9

Compression:

Stored size: 560 Bytes

Contents

module IntrospectiveGrape
  module SnakeParams

    def snake_params_before_validation
      before_validation do
        # We have to snake case the Rack params then re-assign @params to the
        # request.params, because of the I-think-very-goofy-and-inexplicable
        # way Grape interacts with both independently of each other
        (CamelSnakeKeys.snake_keys(params)||{}).each do |k,v|
          request.delete_param(k.camelize(:lower))
          request.update_param(k, v)
        end
        @params = request.params
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
introspective_grape-0.4.3 lib/introspective_grape/snake_params.rb
introspective_grape-0.4.2 lib/introspective_grape/snake_params.rb
introspective_grape-0.4.1 lib/introspective_grape/snake_params.rb
introspective_grape-0.4.0 lib/introspective_grape/snake_params.rb
introspective_grape-0.3.9 lib/introspective_grape/snake_params.rb
introspective_grape-0.3.7 lib/introspective_grape/snake_params.rb
introspective_grape-0.3.6 lib/introspective_grape/snake_params.rb
introspective_grape-0.3.5 lib/introspective_grape/snake_params.rb
introspective_grape-0.3.3 lib/introspective_grape/snake_params.rb