Class: Azeroth::ParamsBuilder Private
- Inherits:
-
Sinclair::Model
- Object
- Sinclair::Model
- Azeroth::ParamsBuilder
- Defined in:
- lib/azeroth/params_builder.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Class responsible for adding params handling methods to a controller
Instance Method Summary collapse
-
#append ⇒ Array<Sinclair::MethodDefinition>
private
Append the params methods to be built.
- #initialize(model: , builder: , options: ) ⇒ ParamsBuilder constructor private
Constructor Details
#initialize(model: , builder: , options: ) ⇒ ParamsBuilder
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
17 |
# File 'lib/azeroth/params_builder.rb', line 17 initialize_with(:model, :builder, :options, writter: false) |
Instance Method Details
#append ⇒ Array<Sinclair::MethodDefinition>
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Append the params methods to be built
22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/azeroth/params_builder.rb', line 22 def append method_name = name allowed_attributes = permitted_attributes.map(&:to_sym) param_key = .param_key add_method("#{name}_id") { params.require(param_key) } add_method("#{name}_params") do params.require(method_name) .permit(*allowed_attributes) end end |