Class: ActiveElement::DefaultController::Params

Inherits:
Object
  • Object
show all
Defined in:
lib/active_element/default_controller/params.rb

Overview

Provides params for ActiveRecord models when using the default boilerplate controller actions. Navigates input parameters and maps them to appropriate relations as needed.

Instance Method Summary collapse

Constructor Details

#initialize(controller:, model:) ⇒ Params

Returns a new instance of Params.



8
9
10
11
# File 'lib/active_element/default_controller/params.rb', line 8

def initialize(controller:, model:)
  @controller = controller
  @model = model
end

Instance Method Details

#paramsObject



13
14
15
16
17
18
# File 'lib/active_element/default_controller/params.rb', line 13

def params
  with_transformed_relations(
    controller.params.require(controller.controller_name.singularize)
              .permit(*permitted_fields)
  )
end