From d51470a8605ff6e44e851d9becd6f24ec3868b63 Mon Sep 17 00:00:00 2001 From: Shaun Ellis Date: Tue, 14 Jun 2016 17:13:27 -0400 Subject: [PATCH] fixes library_id problem --- app/models/locations/floor.rb | 2 -- app/views/locations/floors/_form.html.erb | 8 ++++++++ ...614154022_add_locations_library_to_locations_floors.rb | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/app/models/locations/floor.rb b/app/models/locations/floor.rb index 39a4358..bf7723c 100644 --- a/app/models/locations/floor.rb +++ b/app/models/locations/floor.rb @@ -3,7 +3,5 @@ class Floor < ActiveRecord::Base include Locations::Labeled include Locations::WithLibrary - belongs_to :holding_library, class_name: 'Locations::Library', foreign_key: :holding_library_id - end end diff --git a/app/views/locations/floors/_form.html.erb b/app/views/locations/floors/_form.html.erb index 9e388f7..a38467a 100644 --- a/app/views/locations/floors/_form.html.erb +++ b/app/views/locations/floors/_form.html.erb @@ -27,6 +27,14 @@ <%= f.label :walkable_areas %>
<%= f.text_field :walkable_areas %> + +
+ <%= f.label 'Library', class: 'col-sm-2 control-label'%> +
+ <%= f.collection_select :locations_library_id, Locations::Library.all, :id, :label, {prompt: "Select a Library"}, {class: "form-control"} %> +
+
+
<%= f.submit %>
diff --git a/db/migrate/20160614154022_add_locations_library_to_locations_floors.rb b/db/migrate/20160614154022_add_locations_library_to_locations_floors.rb index e3f0ce7..ef8c2e0 100644 --- a/db/migrate/20160614154022_add_locations_library_to_locations_floors.rb +++ b/db/migrate/20160614154022_add_locations_library_to_locations_floors.rb @@ -1,5 +1,5 @@ class AddLocationsLibraryToLocationsFloors < ActiveRecord::Migration def change - add_reference :locations_floors, :locations_libraries, index: true, foreign_key: true + add_reference :locations_floors, :locations_library, index: true, foreign_key: true end end