af83/chouette-core

View on GitHub
app/lib/new_scope_form_builder.rb

Summary

Maintainability
A
0 mins
Test Coverage
# frozen_string_literal: true

# Used to change the base object_name to create form template
class NewScopeFormBuilder < SimpleForm::FormBuilder
  def initialize(*arguments)
    super

    # macro_list[macros_attributes][new_child] => new_scope[macros_attributes][new_child]
    # control_list[controls_attributes][new_child] => new_scope[controls_attributes][new_child]
    @object_name = @object_name.gsub(/^[a-z_]+\[/, 'new_scope[')
  end
end