Class: TypedFormModel::StrongParamsBuilder
- Inherits:
-
Object
- Object
- TypedFormModel::StrongParamsBuilder
- Defined in:
- lib/typed_form_model/strong_params_builder.rb
Overview
Builds the strong-params whitelist for a form class. Scalar props become
their name as a string; array props become {"name" => []}; nested-form
props become {"name_attributes" => SubForm.keys_for_permit}.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(form_class) ⇒ StrongParamsBuilder
constructor
A new instance of StrongParamsBuilder.
Constructor Details
#initialize(form_class) ⇒ StrongParamsBuilder
8 9 10 |
# File 'lib/typed_form_model/strong_params_builder.rb', line 8 def initialize(form_class) @form_class = form_class end |
Instance Method Details
#call ⇒ Object
12 13 14 |
# File 'lib/typed_form_model/strong_params_builder.rb', line 12 def call form_class.literal_properties.map { |prop| entry_for(prop) } end |