can I transcribe the examples given at the Action View Form Helpers Guide (https://guides.rubyonrails.org/form_helpers.html#nested-forms) on Nested Forms to Nested Forms and the example given in the Routes Guide (https://guides.rubyonrails.org/routing.html#nested-resources) on nested resources to the case of Self-Joins as described in the Associations Guide (https://guides.rubyonrails.org/association_basics.html#self-joins)
Self-Joins
class Employee < ApplicationRecord
has_many :subordinates, class_name: "Employee",
foreign_key: "manager_id"
belongs_to :manager, class_name: "Employee", optional: true
end
Nested Form Helpers Example
<%= form_with model: @person do |f| %>
Addresses:
<ul>
<%= f.fields_for :addresses do |addresses_form| %>
<li>
<%= addresses_form.label :kind %>
<%= addresses_form.text_field :kind %>
<%= addresses_form.label :street %>
<%= addresses_form.text_field :street %>
...
</li>
<% end %>
</ul>
<% end %>
Nested Route Helpers Example
resources :magazines do
resources :ads
end