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: ) ⇒ ParamsBuilder constructor private
Constructor Details
#initialize(model: , builder: ) ⇒ 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.
16 |
# File 'lib/azeroth/params_builder.rb', line 16 initialize_with(:model, :builder, 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
21 22 23 24 25 26 27 28 29 30 |
# File 'lib/azeroth/params_builder.rb', line 21 def append method_name = name allowed_attributes = permitted_attributes.map(&:to_sym) add_method("#{name}_id") { params.require(:id) } add_method("#{name}_params") do params.require(method_name) .permit(*allowed_attributes) end end |