Module: TypedParams::Formatters::Rails
- Defined in:
- lib/typed_params/formatters/rails.rb
Overview
The Rails formatter wraps the params in a key matching the current controller’s name.
For example, in a UsersController context, given the params:
{ email: '[email protected]' }
The final params would become:
{ user: { email: '[email protected]' } }
Class Method Summary collapse
Class Method Details
.call(params, controller:) ⇒ Object
20 21 22 23 24 |
# File 'lib/typed_params/formatters/rails.rb', line 20 def self.call(params, controller:) key = controller.controller_name.singularize.to_sym { key => params } end |