diff --git a/app/models/sites_neighbourhood.rb b/app/models/sites_neighbourhood.rb index 7656ca50f..1c5d5e4c7 100644 --- a/app/models/sites_neighbourhood.rb +++ b/app/models/sites_neighbourhood.rb @@ -9,4 +9,8 @@ class SitesNeighbourhood < ApplicationRecord scope: :site_id, message: 'Neighbourhood cannot be assigned more than once to a site' } + + def name + neighbourhood.to_s + end end diff --git a/app/views/admin/sites/_form.html.erb b/app/views/admin/sites/_form.html.erb index bf892ab7e..877b01bb0 100644 --- a/app/views/admin/sites/_form.html.erb +++ b/app/views/admin/sites/_form.html.erb @@ -68,11 +68,11 @@ collection: options_for_sites_neighbourhoods, input_html: {class: 'form-control select2' } %> - <%= f.simple_fields_for :site__neighbourhoods do |neighbourhood| %> - <%= render 'sites_neighbourhoods', :f => neighbourhood %> + <%= f.simple_fields_for :sites_neighbourhoods do |neighbourhood| %> + <%= render 'sites_neighbourhood_fields', :f => neighbourhood %> <% end %> diff --git a/app/views/admin/sites/_sites_neighbourhood_fields.erb b/app/views/admin/sites/_sites_neighbourhood_fields.erb deleted file mode 100644 index a8d90b672..000000000 --- a/app/views/admin/sites/_sites_neighbourhood_fields.erb +++ /dev/null @@ -1,2 +0,0 @@ -<%= f.input :name %> -<%= f.hidden_field :relation_type, value: "Secondary" %> diff --git a/app/views/admin/sites/_sites_neighbourhoods.erb b/app/views/admin/sites/_sites_neighbourhood_fields.html.erb similarity index 100% rename from app/views/admin/sites/_sites_neighbourhoods.erb rename to app/views/admin/sites/_sites_neighbourhood_fields.html.erb