Skip to content

Commit ec5de58

Browse files
stefan-burketerragon-labs[bot]
andcommitted
refactor(form_configurable): simplify YAML form config loading with symbol keys
- Remove namespace usage and use class name only for YAML file lookup - Load form config YAML and directly map form fields with symbol keys - Remove unnecessary deep_symbolize_keys call on entire YAML content - Add comments clarifying the changes in YAML key handling Co-authored-by: terragon-labs[bot] <terragon-labs[bot]@users.noreply.github.com>
1 parent 1d88fef commit ec5de58

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

app/models/concerns/form_configurable.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,15 @@ def form_fields(user: nil)
1515

1616
sig { returns(T::Array[T::Hash[Symbol, T.untyped]]) }
1717
def load_form_config_from_yaml
18+
# Remove namespace and use just the class name
1819
file_name = name.demodulize.underscore
1920
config_path = Rails.root.join("config/forms/#{file_name}.yml")
2021
yaml_content = YAML.load_file(config_path)
21-
yaml_content.deep_symbolize_keys!
22+
yaml_content["form_fields"].map do |fieldset|
23+
fieldset = fieldset.deep_symbolize_keys
24+
# Fields now have symbols directly in YAML, no conversion needed
25+
fieldset
26+
end
2227
end
2328
end
2429
end

0 commit comments

Comments
 (0)