Sha256: f8823ce69aeb83c0520b087b1ef46437d83c559f29c045e80743564ff01df56c

Contents?: true

Size: 562 Bytes

Versions: 7

Compression:

Stored size: 562 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

7 entries across 7 versions & 1 rubygems

Version Path
introspective_grape-0.6.1 lib/introspective_grape/snake_params.rb
introspective_grape-0.5.7 lib/introspective_grape/snake_params.rb
introspective_grape-0.5.6 lib/introspective_grape/snake_params.rb
introspective_grape-0.5.5 lib/introspective_grape/snake_params.rb
introspective_grape-0.5.4 lib/introspective_grape/snake_params.rb
introspective_grape-0.5.2 lib/introspective_grape/snake_params.rb
introspective_grape-0.5.0 lib/introspective_grape/snake_params.rb