Class: ActiveElement::PreRenderProcessors::Json
- Inherits:
-
Object
- Object
- ActiveElement::PreRenderProcessors::Json
- Defined in:
- lib/active_element/pre_render_processors/json.rb
Overview
Selects fields from ‘__json_fields` param created by `Components::JsonField` and parses each field’s JSON data back into request params to allow for transparent JSON data receipt. All params are permitted and converted to a Hash to allow them to be modified before converting back to ActionController::Params to avoid disrupting the Rails request flow.
Instance Method Summary collapse
-
#initialize(controller:) ⇒ Json
constructor
A new instance of Json.
- #process ⇒ Object
Constructor Details
#initialize(controller:) ⇒ Json
Returns a new instance of Json.
10 11 12 |
# File 'lib/active_element/pre_render_processors/json.rb', line 10 def initialize(controller:) @controller = controller end |
Instance Method Details
#process ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/active_element/pre_render_processors/json.rb', line 14 def process return if json_fields.blank? process_json_fields rebuild_action_controller_parameters end |