<%= form_with model: @stat, url: character_sheet_section_stats_path(@section) do |f| %> <% if @stat.new_record? %> <%= f.fields_for :character_sheet_feature do |ff| %> <%= ff.hidden_field :featurable_id, value: @stat.id %> <%= ff.hidden_field :character_sheet_section_id, value: @section.id %> <% end %> <% end %> <%= f.label :name %> <%= f.text_field :name %> <%= display_form_errors(@section, :name) %> <%= f.label :roll_command %> <%= f.text_field :roll_command %> <%= display_form_errors(@section, :roll_command) %> <%= f.submit button_text %> <% end %>