Module: StrongerParameters::ControllerSupport::PermittedParameters
- Defined in:
- lib/stronger_parameters/controller_support/permitted_parameters.rb
Defined Under Namespace
Modules: ClassMethods
Constant Summary collapse
- DEFAULT_PERMITTED =
{ controller: ActionController::Parameters.anything, action: ActionController::Parameters.anything, format: ActionController::Parameters.anything, authenticity_token: ActionController::Parameters.string, utf8: Parameters.string, _method: Parameters.string, commit: Parameters.string }.freeze
Class Method Summary collapse
Class Method Details
.included(klass) ⇒ Object
8 9 10 11 |
# File 'lib/stronger_parameters/controller_support/permitted_parameters.rb', line 8 def self.included(klass) klass.extend ClassMethods klass.before_action :permit_parameters end |
.sugar(value) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/stronger_parameters/controller_support/permitted_parameters.rb', line 13 def self.sugar(value) case value when Array ActionController::Parameters.array(*value.map { |v| sugar(v) }) when Hash constraints = value.transform_values { |v| sugar(v) } ActionController::Parameters.map(constraints) else value end end |