Module: IntrospectiveGrape::SnakeParams
- Included in:
- API
- Defined in:
- lib/introspective_grape/snake_params.rb
Instance Method Summary collapse
Instance Method Details
#snake_params_before_validation ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 |
# File 'lib/introspective_grape/snake_params.rb', line 3 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 |