Module: IronAdmin::Concerns::JsonParamsCoercion

Extended by:
ActiveSupport::Concern
Included in:
ResourcesController
Defined in:
app/controllers/iron_admin/concerns/json_params_coercion.rb

Overview

Coerces incoming :json form params from JSON strings (the textarea content rendered by _form.html.haml's when :json branch) back into Ruby Hash/Array. Without this, the controller would assign the raw textarea string to the model's jsonb/json column, replacing the structured value with a string and silently losing data.

Invalid JSON is left as-is so model-side validation can surface the error to the user instead of being swallowed.