From ea8f84931f14e700213070577f82208a440b0ddf Mon Sep 17 00:00:00 2001 From: Nico Date: Wed, 5 Dec 2018 19:15:14 +0000 Subject: [PATCH 01/12] Allows to set a global ParamBuilder --- README.md | 22 ++++++++++++++++++++++ lib/grape.rb | 1 + lib/grape/config.rb | 24 ++++++++++++++++++++++++ lib/grape/request.rb | 2 +- spec/grape/config_spec.rb | 37 +++++++++++++++++++++++++++++++++++++ spec/grape/request_spec.rb | 18 ++++++++++++++++++ 6 files changed, 103 insertions(+), 1 deletion(-) create mode 100644 lib/grape/config.rb create mode 100644 spec/grape/config_spec.rb diff --git a/README.md b/README.md index 805c6a5665..c46657a68e 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,7 @@ - [Accept-Version Header](#accept-version-header) - [Param](#param) - [Describing Methods](#describing-methods) +- [Configuration][#configuration] - [Parameters](#parameters) - [Params Class](#params-class) - [Declared](#declared) @@ -541,6 +542,25 @@ end [grape-swagger]: https://github.com/ruby-grape/grape-swagger +## Configuration + +Grape counts with a module `Grape::Config` for some basic configuration at load time. +Currently the configurable settings are: + +* `param_builder`: Sets the default [Parameter Builder](#parameters), by default: `Grape::Extensions::ActiveSupport::HashWithIndifferentAccess::ParamBuilder` + +To change a setting value make sure that at some point on load time the code the following code runs + +```ruby +Grape::Config[setting] = value +``` + +For example, for the `param_builder`, the following code could run in an initializers: + +```ruby +Grape::Config[:param_builder] = Grape::Extensions::Hashie::Mash::ParamBuilder +``` + ## Parameters Request parameters are available through the `params` hash object. This includes `GET`, `POST` @@ -618,6 +638,8 @@ params do end ``` +Or globally with the [Configuration](#configuration) `Grape::Config[:param_builder]` + In the example above, `params["color"]` will return `nil` since `params` is a plain `Hash`. Available parameter builders are `Grape::Extensions::Hash::ParamBuilder`, `Grape::Extensions::ActiveSupport::HashWithIndifferentAccess::ParamBuilder` and `Grape::Extensions::Hashie::Mash::ParamBuilder`. diff --git a/lib/grape.rb b/lib/grape.rb index d626ec5c0c..a4ccd9d9bb 100644 --- a/lib/grape.rb +++ b/lib/grape.rb @@ -34,6 +34,7 @@ module Grape autoload :Namespace autoload :Path + autoload :Config autoload :Cookies autoload :Validations diff --git a/lib/grape/config.rb b/lib/grape/config.rb new file mode 100644 index 0000000000..6fb3705187 --- /dev/null +++ b/lib/grape/config.rb @@ -0,0 +1,24 @@ +module Grape + module Config + module SettingStore + def setting(setting_name, opts = {}) + @setting_caller ||= {}.with_indifferent_access + default_caller = opts[:default] || -> { nil } + @setting_caller[setting_name] = { default: default_caller } + end + + def [](setting_name) + callers = @setting_caller[setting_name] + (callers[:configured] || callers[:default]).call + end + + def []=(setting_name, value) + @setting_caller[setting_name][:configured] = -> { value } + end + end + # A singleton setup module + extend SettingStore + + setting :param_builder, default: -> { Grape::Extensions::ActiveSupport::HashWithIndifferentAccess::ParamBuilder } + end +end diff --git a/lib/grape/request.rb b/lib/grape/request.rb index 0f11dff9e6..dc5e268897 100644 --- a/lib/grape/request.rb +++ b/lib/grape/request.rb @@ -5,7 +5,7 @@ class Request < Rack::Request alias rack_params params def initialize(env, options = {}) - extend options[:build_params_with] || Grape::Extensions::ActiveSupport::HashWithIndifferentAccess::ParamBuilder + extend options[:build_params_with] || Grape::Config[:param_builder] super(env) end diff --git a/spec/grape/config_spec.rb b/spec/grape/config_spec.rb new file mode 100644 index 0000000000..e64390a307 --- /dev/null +++ b/spec/grape/config_spec.rb @@ -0,0 +1,37 @@ +require 'spec_helper' + +module Grape + describe Config do + let(:config_double) { Module.new { extend Config::SettingStore } } + + context 'when a test_setting exists' do + let(:default_value) { rand } + + before do + config_double.setting :test_setting, default: -> { default_value } + end + + subject(:setting) { config_double[:test_setting] } + + context 'when only the default value is set' do + it { is_expected.to eq default_value } + end + + context 'when the value is set' do + let(:set_value) { -1 } + before { config_double[:test_setting] = set_value } + it { is_expected.to eq set_value } + end + + context 'when the default is true and the value is false' do + before do + config_double.setting :boolean_test_setting, default: -> { true } + config_double[:boolean_test_setting] = false + end + + subject(:boolean_test_setting) { config_double[:boolean_test_setting] } + it { is_expected.to be false } + end + end + end +end diff --git a/spec/grape/request_spec.rb b/spec/grape/request_spec.rb index b763532ca4..c02bc9661d 100644 --- a/spec/grape/request_spec.rb +++ b/spec/grape/request_spec.rb @@ -62,6 +62,24 @@ module Grape end end + describe 'when the param_builder is set to Hashie' do + before do + allow(Grape::Config).to receive(:[]).with(:param_builder) { Grape::Extensions::Hashie::Mash::ParamBuilder } + end + + subject(:request_params) { Grape::Request.new(env, opts).params } + + context 'when the API does not include a specific param builder' do + let(:opts) { {} } + it { is_expected.to be_a(Hashie::Mash) } + end + + context 'when the API includes a specific param builder' do + let(:opts) { { build_params_with: Grape::Extensions::Hash::ParamBuilder } } + it { is_expected.to be_a(Hash) } + end + end + describe '#headers' do let(:options) do default_options.merge(request_headers) From 96ae2254f35451826d56f31040563459a1f3d127 Mon Sep 17 00:00:00 2001 From: Nico Date: Wed, 5 Dec 2018 19:17:55 +0000 Subject: [PATCH 02/12] Added change to changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9e42a83e8c..0ba4e917b6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ * Your contribution here. * [#1832](https://github.com/ruby-grape/grape/pull/1832): Support `body_name` in `desc` block - [@fotos](https://github.com/fotos). * [#1831](https://github.com/ruby-grape/grape/pull/1831): Support `security` in `desc` block - [@fotos](https://github.com/fotos). +* [#1833](https://github.com/ruby-grape/grape/pull/1833), Allows to set the ParamBuilder globally - [@myxoh](https://github.com/myxoh). #### Fixes From f2378f3e6de3cd0be628c8fa00d76afb292ba9e6 Mon Sep 17 00:00:00 2001 From: Nico Date: Wed, 5 Dec 2018 19:18:49 +0000 Subject: [PATCH 03/12] Fixes readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c46657a68e..5490e69d60 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ - [Accept-Version Header](#accept-version-header) - [Param](#param) - [Describing Methods](#describing-methods) -- [Configuration][#configuration] +- [Configuration](#configuration) - [Parameters](#parameters) - [Params Class](#params-class) - [Declared](#declared) From 8916254987f2611f18c97d58c361359b579ea09f Mon Sep 17 00:00:00 2001 From: Nico Date: Wed, 5 Dec 2018 19:20:22 +0000 Subject: [PATCH 04/12] Renames configuration to mount configuration where relevant --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 5490e69d60..75f06d7de4 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ - [Rails](#rails) - [Modules](#modules) - [Remounting](#remounting) - - [Configuration](#configuration) + - [Mount Configuration](#mount-configuration) - [Versioning](#versioning) - [Path](#path) - [Header](#header) @@ -396,7 +396,7 @@ end Assuming that the post and comment endpoints are mounted in `/posts` and `/comments`, you should now be able to do `get /posts/votes`, `post /posts/votes`, `get /comments/votes`. -### Configuration +### Mount Configuration You can configure remountable endpoints for small details changing according to where they are mounted. From cf0a6c7b0de7fff9b5958bf37d8378fcc4c64ba8 Mon Sep 17 00:00:00 2001 From: Nicolas Klein Date: Wed, 5 Dec 2018 23:45:55 +0000 Subject: [PATCH 05/12] Fixes changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0ba4e917b6..110a90ea75 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,9 +3,9 @@ #### Features * Your contribution here. +* [#1833](https://github.com/ruby-grape/grape/pull/1833): Allows to set the `ParamBuilder` globally - [@myxoh](https://github.com/myxoh). * [#1832](https://github.com/ruby-grape/grape/pull/1832): Support `body_name` in `desc` block - [@fotos](https://github.com/fotos). * [#1831](https://github.com/ruby-grape/grape/pull/1831): Support `security` in `desc` block - [@fotos](https://github.com/fotos). -* [#1833](https://github.com/ruby-grape/grape/pull/1833), Allows to set the ParamBuilder globally - [@myxoh](https://github.com/myxoh). #### Fixes From 37f949dd6694b8a74f57e14dd1d5e711b499686f Mon Sep 17 00:00:00 2001 From: Nico Date: Fri, 7 Dec 2018 03:18:57 +0000 Subject: [PATCH 06/12] Changes configuration syntax to `configure` --- README.md | 10 +++++++--- lib/grape/config.rb | 27 +++++++++++++++------------ lib/grape/request.rb | 2 +- spec/grape/config_spec.rb | 32 +++++++------------------------- spec/grape/request_spec.rb | 2 +- 5 files changed, 31 insertions(+), 42 deletions(-) diff --git a/README.md b/README.md index 75f06d7de4..a67cdf00e4 100644 --- a/README.md +++ b/README.md @@ -552,13 +552,17 @@ Currently the configurable settings are: To change a setting value make sure that at some point on load time the code the following code runs ```ruby -Grape::Config[setting] = value +Grape::Config.configure do |config| + config.setting = value +end ``` For example, for the `param_builder`, the following code could run in an initializers: ```ruby -Grape::Config[:param_builder] = Grape::Extensions::Hashie::Mash::ParamBuilder +Grape::Config.configure do |config| + config.param_builder = Grape::Extensions::Hashie::Mash::ParamBuilder +end ``` ## Parameters @@ -638,7 +642,7 @@ params do end ``` -Or globally with the [Configuration](#configuration) `Grape::Config[:param_builder]` +Or globally with the [Configuration](#configuration) `Grape::Config.param_builder` In the example above, `params["color"]` will return `nil` since `params` is a plain `Hash`. diff --git a/lib/grape/config.rb b/lib/grape/config.rb index 6fb3705187..b1b8e30885 100644 --- a/lib/grape/config.rb +++ b/lib/grape/config.rb @@ -1,24 +1,27 @@ module Grape module Config module SettingStore - def setting(setting_name, opts = {}) - @setting_caller ||= {}.with_indifferent_access - default_caller = opts[:default] || -> { nil } - @setting_caller[setting_name] = { default: default_caller } + ATTRIBUTES = %i[ + param_builder + ].freeze + + attr_accessor(*SettingStore::ATTRIBUTES) + + def reset + self.param_builder = Grape::Extensions::ActiveSupport::HashWithIndifferentAccess::ParamBuilder end - def [](setting_name) - callers = @setting_caller[setting_name] - (callers[:configured] || callers[:default]).call + def configure + block_given? ? yield(self) : self end - def []=(setting_name, value) - @setting_caller[setting_name][:configured] = -> { value } + def config + self end end - # A singleton setup module - extend SettingStore - setting :param_builder, default: -> { Grape::Extensions::ActiveSupport::HashWithIndifferentAccess::ParamBuilder } + Grape::Config.extend SettingStore end end + +Grape::Config.reset diff --git a/lib/grape/request.rb b/lib/grape/request.rb index dc5e268897..d8300b1533 100644 --- a/lib/grape/request.rb +++ b/lib/grape/request.rb @@ -5,7 +5,7 @@ class Request < Rack::Request alias rack_params params def initialize(env, options = {}) - extend options[:build_params_with] || Grape::Config[:param_builder] + extend options[:build_params_with] || Grape::Config.param_builder super(env) end diff --git a/spec/grape/config_spec.rb b/spec/grape/config_spec.rb index e64390a307..9054a49fee 100644 --- a/spec/grape/config_spec.rb +++ b/spec/grape/config_spec.rb @@ -4,33 +4,15 @@ module Grape describe Config do let(:config_double) { Module.new { extend Config::SettingStore } } - context 'when a test_setting exists' do - let(:default_value) { rand } - - before do - config_double.setting :test_setting, default: -> { default_value } - end - - subject(:setting) { config_double[:test_setting] } - - context 'when only the default value is set' do - it { is_expected.to eq default_value } - end - - context 'when the value is set' do - let(:set_value) { -1 } - before { config_double[:test_setting] = set_value } - it { is_expected.to eq set_value } - end - - context 'when the default is true and the value is false' do - before do - config_double.setting :boolean_test_setting, default: -> { true } - config_double[:boolean_test_setting] = false + context 'when configured' do + subject(:configure) do + config_double.configure do |config| + config.param_builder = 42 end + end - subject(:boolean_test_setting) { config_double[:boolean_test_setting] } - it { is_expected.to be false } + it 'changes the value' do + expect { configure }.to change { config_double.param_builder }.to(42) end end end diff --git a/spec/grape/request_spec.rb b/spec/grape/request_spec.rb index c02bc9661d..023c51f52b 100644 --- a/spec/grape/request_spec.rb +++ b/spec/grape/request_spec.rb @@ -64,7 +64,7 @@ module Grape describe 'when the param_builder is set to Hashie' do before do - allow(Grape::Config).to receive(:[]).with(:param_builder) { Grape::Extensions::Hashie::Mash::ParamBuilder } + allow(Grape::Config).to receive(:param_builder) { Grape::Extensions::Hashie::Mash::ParamBuilder } end subject(:request_params) { Grape::Request.new(env, opts).params } From e23f587584634793342106f9668f3b23e9665a09 Mon Sep 17 00:00:00 2001 From: Nico Date: Fri, 7 Dec 2018 17:09:11 +0000 Subject: [PATCH 07/12] Loads configuration first thing --- lib/grape.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/grape.rb b/lib/grape.rb index a4ccd9d9bb..90597562d3 100644 --- a/lib/grape.rb +++ b/lib/grape.rb @@ -34,8 +34,6 @@ module Grape autoload :Namespace autoload :Path - autoload :Config - autoload :Cookies autoload :Validations autoload :ErrorFormatter @@ -195,6 +193,7 @@ module ServeFile end end +require 'grape/config' require 'grape/util/content_types' require 'grape/validations/validators/base' From 386615f0551f7c0f67ed08eec1b83fa34cb8a42a Mon Sep 17 00:00:00 2001 From: Nico Date: Fri, 7 Dec 2018 17:09:51 +0000 Subject: [PATCH 08/12] Uses `.configure` on Grape rather than Grape::Config --- README.md | 8 ++++---- lib/grape/config.rb | 23 ++++++++++++++--------- lib/grape/request.rb | 2 +- spec/grape/config_spec.rb | 33 ++++++++++++++++++++++----------- spec/grape/request_spec.rb | 2 +- 5 files changed, 42 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index a67cdf00e4..d255b900fe 100644 --- a/README.md +++ b/README.md @@ -544,7 +544,7 @@ end ## Configuration -Grape counts with a module `Grape::Config` for some basic configuration at load time. +Grape counts with a module `Grape.configure` for some basic configuration at load time. Currently the configurable settings are: * `param_builder`: Sets the default [Parameter Builder](#parameters), by default: `Grape::Extensions::ActiveSupport::HashWithIndifferentAccess::ParamBuilder` @@ -552,7 +552,7 @@ Currently the configurable settings are: To change a setting value make sure that at some point on load time the code the following code runs ```ruby -Grape::Config.configure do |config| +Grape.configure do |config| config.setting = value end ``` @@ -560,7 +560,7 @@ end For example, for the `param_builder`, the following code could run in an initializers: ```ruby -Grape::Config.configure do |config| +Grape.configure do |config| config.param_builder = Grape::Extensions::Hashie::Mash::ParamBuilder end ``` @@ -642,7 +642,7 @@ params do end ``` -Or globally with the [Configuration](#configuration) `Grape::Config.param_builder` +Or globally with the [Configuration](#configuration) `Grape.configure.param_builder` In the example above, `params["color"]` will return `nil` since `params` is a plain `Hash`. diff --git a/lib/grape/config.rb b/lib/grape/config.rb index b1b8e30885..a1ebb706a1 100644 --- a/lib/grape/config.rb +++ b/lib/grape/config.rb @@ -1,27 +1,32 @@ module Grape module Config - module SettingStore + class Configuration ATTRIBUTES = %i[ param_builder ].freeze - attr_accessor(*SettingStore::ATTRIBUTES) + attr_accessor(*ATTRIBUTES) + + def initialize + reset + end def reset self.param_builder = Grape::Extensions::ActiveSupport::HashWithIndifferentAccess::ParamBuilder end + end - def configure - block_given? ? yield(self) : self + def self.extended(base) + def base.configure + block_given? ? yield(config) : config end - def config - self + def base.config + @configuration ||= Grape::Config::Configuration.new end end - - Grape::Config.extend SettingStore end end -Grape::Config.reset +Grape.extend Grape::Config +Grape.config.reset diff --git a/lib/grape/request.rb b/lib/grape/request.rb index d8300b1533..7209a60d02 100644 --- a/lib/grape/request.rb +++ b/lib/grape/request.rb @@ -5,7 +5,7 @@ class Request < Rack::Request alias rack_params params def initialize(env, options = {}) - extend options[:build_params_with] || Grape::Config.param_builder + extend options[:build_params_with] || Grape.config.param_builder super(env) end diff --git a/spec/grape/config_spec.rb b/spec/grape/config_spec.rb index 9054a49fee..48a07eef45 100644 --- a/spec/grape/config_spec.rb +++ b/spec/grape/config_spec.rb @@ -1,19 +1,30 @@ require 'spec_helper' -module Grape - describe Config do - let(:config_double) { Module.new { extend Config::SettingStore } } +describe '.configure' do + let!(:grape_double) { Module.new { extend Grape::Config } } - context 'when configured' do - subject(:configure) do - config_double.configure do |config| - config.param_builder = 42 - end - end + context 'when not configured' do + it 'does not change when resetted' do + expect { grape_double.config.reset }.not_to change { grape_double.config.param_builder } + end + end - it 'changes the value' do - expect { configure }.to change { config_double.param_builder }.to(42) + context 'when configured' do + subject(:configure) do + grape_double.configure do |config| + config.param_builder = 42 end end + + it 'changes the value' do + expect { configure }.to change { grape_double.config.param_builder }.to(42) + end + + it 'can be restored by resetting' do + configure + expect { grape_double.config.reset } + .to change { grape_double.config.param_builder } + .from(42) + end end end diff --git a/spec/grape/request_spec.rb b/spec/grape/request_spec.rb index 023c51f52b..6cfb516819 100644 --- a/spec/grape/request_spec.rb +++ b/spec/grape/request_spec.rb @@ -64,7 +64,7 @@ module Grape describe 'when the param_builder is set to Hashie' do before do - allow(Grape::Config).to receive(:param_builder) { Grape::Extensions::Hashie::Mash::ParamBuilder } + allow(Grape.configure).to receive(:param_builder) { Grape::Extensions::Hashie::Mash::ParamBuilder } end subject(:request_params) { Grape::Request.new(env, opts).params } From 914d7794281a93297da782dd9159c5dd4a57d960 Mon Sep 17 00:00:00 2001 From: Nico Date: Fri, 7 Dec 2018 17:35:42 +0000 Subject: [PATCH 09/12] Rubocop missing issues --- spec/grape/config_spec.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/spec/grape/config_spec.rb b/spec/grape/config_spec.rb index 48a07eef45..58d9e76d6d 100644 --- a/spec/grape/config_spec.rb +++ b/spec/grape/config_spec.rb @@ -5,7 +5,8 @@ context 'when not configured' do it 'does not change when resetted' do - expect { grape_double.config.reset }.not_to change { grape_double.config.param_builder } + expect { grape_double.config.reset } + .not_to(change { grape_double.config.param_builder }) end end @@ -23,8 +24,8 @@ it 'can be restored by resetting' do configure expect { grape_double.config.reset } - .to change { grape_double.config.param_builder } - .from(42) + .to change { grape_double.config.param_builder } + .from(42) end end end From b64c636adb3002fb1bd8597b46de2735a00e5c32 Mon Sep 17 00:00:00 2001 From: Nico Date: Sun, 9 Dec 2018 23:26:03 +0000 Subject: [PATCH 10/12] [Issue-1775] configures the param builder with a new value --- spec/grape/config_spec.rb | 30 ++++++++---------------------- 1 file changed, 8 insertions(+), 22 deletions(-) diff --git a/spec/grape/config_spec.rb b/spec/grape/config_spec.rb index 58d9e76d6d..f9290e3c76 100644 --- a/spec/grape/config_spec.rb +++ b/spec/grape/config_spec.rb @@ -1,31 +1,17 @@ require 'spec_helper' describe '.configure' do - let!(:grape_double) { Module.new { extend Grape::Config } } - - context 'when not configured' do - it 'does not change when resetted' do - expect { grape_double.config.reset } - .not_to(change { grape_double.config.param_builder }) + before do + Grape.configure do |config| + config.param_builder = 42 end end - context 'when configured' do - subject(:configure) do - grape_double.configure do |config| - config.param_builder = 42 - end - end - - it 'changes the value' do - expect { configure }.to change { grape_double.config.param_builder }.to(42) - end + after do + Grape.config.reset + end - it 'can be restored by resetting' do - configure - expect { grape_double.config.reset } - .to change { grape_double.config.param_builder } - .from(42) - end + it 'is configured to the new value' do + expect(Grape.config.param_builder).to eq 42 end end From 3793e649e5e4c3879e3a11ac5a7eed533bc1bdbe Mon Sep 17 00:00:00 2001 From: Nico Date: Sun, 9 Dec 2018 23:41:10 +0000 Subject: [PATCH 11/12] [Issue-1775] undoes mocking on request_spec --- spec/grape/request_spec.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/spec/grape/request_spec.rb b/spec/grape/request_spec.rb index 6cfb516819..2c352d1751 100644 --- a/spec/grape/request_spec.rb +++ b/spec/grape/request_spec.rb @@ -64,7 +64,13 @@ module Grape describe 'when the param_builder is set to Hashie' do before do - allow(Grape.configure).to receive(:param_builder) { Grape::Extensions::Hashie::Mash::ParamBuilder } + Grape.configure do |config| + config.param_builder = Grape::Extensions::Hashie::Mash::ParamBuilder + end + end + + after do + Grape.config.reset end subject(:request_params) { Grape::Request.new(env, opts).params } From 20833c3cecef8379484ab3cce1d909a89061c05a Mon Sep 17 00:00:00 2001 From: Nico Date: Mon, 10 Dec 2018 10:31:04 +0000 Subject: [PATCH 12/12] Slight cosmetic improvements to Readme.md --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 9c22808ad7..6d0d6721a1 100644 --- a/README.md +++ b/README.md @@ -544,10 +544,10 @@ end ## Configuration -Grape counts with a module `Grape.configure` for some basic configuration at load time. +Use `Grape.configure` to set up global settings at load time. Currently the configurable settings are: -* `param_builder`: Sets the default [Parameter Builder](#parameters), by default: `Grape::Extensions::ActiveSupport::HashWithIndifferentAccess::ParamBuilder` +* `param_builder`: Sets the [Parameter Builder](#parameters), defaults to `Grape::Extensions::ActiveSupport::HashWithIndifferentAccess::ParamBuilder`. To change a setting value make sure that at some point on load time the code the following code runs @@ -642,7 +642,7 @@ params do end ``` -Or globally with the [Configuration](#configuration) `Grape.configure.param_builder` +Or globally with the [Configuration](#configuration) `Grape.configure.param_builder`. In the example above, `params["color"]` will return `nil` since `params` is a plain `Hash`.