Ruby on Rails. Ассоциации в шаблоне
Есть форма(файл "_form.html.erb"):
<%= form_with(model: product) do |form| %>
<% if product.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(product.errors.count, "error") %> prohibited this product from being saved:</h2>
<ul>
<% product.errors.each do |error| %>
<li><%= error.full_message %></li>
<% end %>
</ul>
</div>
<% end %>
<div class="field">
<%= form.label :city_id %>
<%= form.text_field :city_id %>
</div>
<div class="field">
<%= form.label :shop_id %>
<%= form.text_field :shop_id %>
</div>
Модели:
class Product < ApplicationRecord
belongs_to :city
belongs_to :shop
end
class Shop < ApplicationRecord
has_many :products
end
Как заменить shop_id на name из связанной таблицы shops?