Hello! First of all - thanks for this excellent gem.
I'm trying to set it up for a custom cms i'm working on but having hard time doing so. I basically done everything as described in README but when saving the actual customizable form, my custom field values are not being stored.
class Node < ApplicationRecord
belongs_to :node_type
has_active_fields scope_method: :node_type_id
end
<div>
<%= form.fields_for :active_fields, form.object.initialize_active_values.sort_by(&:active_field_id), include_id: false do |active_fields_form| %>
<%= active_fields_form.hidden_field :name %>
<%= render_active_value_input(form: active_fields_form, active_value: active_fields_form.object) %>
<% end %>
</div>
def node_params
permitted_params = params.expect(node: [ :title, :node_type_id, active_fields_attributes: [ :name, :value, :_destroy, value: [] ] ])
permitted_params[:active_fields_attributes]&.each do |_index, value_attrs|
value_attrs[:value] = compact_array_param(value_attrs[:value]) if value_attrs[:value].is_a?(Array)
end
permitted_params
end
And after submitting my form, i can see my params are coming in properly, no unpermitted attributes error is being produced and yet still, nothing gets stored in the DB.
Started PATCH "/nodes/1" for ::1 at 2026-06-20 09:49:47 +0200
Processing by NodesController#update as TURBO_STREAM
Parameters: {"authenticity_token" => "[FILTERED]", "node" => {"title" => "Test", "active_fields_attributes" => {"0" => {"name" => "Client", "value" => "ggaw"}}}, "commit" => "Update Node", "id" => "1"}
Node Load (0.1ms) SELECT "nodes".* FROM "nodes" WHERE "nodes"."id" = 1 LIMIT 1 /*action='update',application='Cms',controller='nodes'*/
↳ app/controllers/nodes_controller.rb:63:in 'NodesController#set_node'
TRANSACTION (0.0ms) BEGIN immediate TRANSACTION /*action='update',application='Cms',controller='nodes'*/
↳ app/controllers/nodes_controller.rb:40:in 'block in NodesController#update'
ActiveFields::Field::Base Load (1.0ms) SELECT "active_fields".* FROM "active_fields" WHERE "active_fields"."customizable_type" = 'Node' AND ("active_fields"."scope" = '1' OR "active_fields"."scope" IS NULL) /*action='update',application='Cms',controller='nodes'*/
↳ app/controllers/nodes_controller.rb:40:in 'block in NodesController#update'
ActiveFields::Value Load (0.0ms) SELECT "active_fields_values".* FROM "active_fields_values" WHERE "active_fields_values"."customizable_id" = 1 AND "active_fields_values"."customizable_type" = 'Node' /*action='update',application='Cms',controller='nodes'*/
↳ app/controllers/nodes_controller.rb:40:in 'block in NodesController#update'
TRANSACTION (0.0ms) COMMIT TRANSACTION /*action='update',application='Cms',controller='nodes'*/
↳ app/controllers/nodes_controller.rb:40:in 'block in NodesController#update'
Redirected to http://localhost:3000/nodes/1
Completed 303 See Other in 47ms (ActiveRecord: 1.1ms (3 queries, 0 cached) | GC: 0.4ms)
Any idea what might be happening in here? Thanks!
Hello! First of all - thanks for this excellent gem.
I'm trying to set it up for a custom cms i'm working on but having hard time doing so. I basically done everything as described in README but when saving the actual customizable form, my custom field values are not being stored.
And after submitting my form, i can see my params are coming in properly, no unpermitted attributes error is being produced and yet still, nothing gets stored in the DB.
Any idea what might be happening in here? Thanks!