From aa25545eb204d0ca842ab948af4c27cb217352d6 Mon Sep 17 00:00:00 2001 From: David Gay Date: Mon, 3 May 2021 18:37:26 -0400 Subject: Locations views --- app/controllers/locations_controller.rb | 9 +++++++++ app/models/location.rb | 1 + app/views/application/_navbar.html.erb | 2 +- app/views/locations/index.html.erb | 8 ++++++++ app/views/locations/show.html.erb | 7 +++++++ config/routes.rb | 2 ++ 6 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 app/controllers/locations_controller.rb create mode 100644 app/views/locations/index.html.erb create mode 100644 app/views/locations/show.html.erb diff --git a/app/controllers/locations_controller.rb b/app/controllers/locations_controller.rb new file mode 100644 index 0000000..4616c3d --- /dev/null +++ b/app/controllers/locations_controller.rb @@ -0,0 +1,9 @@ +class LocationsController < ApplicationController + def index + @locations = Location.all + end + + def show + @location = Location.find(params[:id]) + end +end diff --git a/app/models/location.rb b/app/models/location.rb index 8816274..e35e5e7 100644 --- a/app/models/location.rb +++ b/app/models/location.rb @@ -1,3 +1,4 @@ class Location < ApplicationRecord + has_many :activities validates :gid, :name, presence: true end diff --git a/app/views/application/_navbar.html.erb b/app/views/application/_navbar.html.erb index 85f4642..104c349 100644 --- a/app/views/application/_navbar.html.erb +++ b/app/views/application/_navbar.html.erb @@ -1,7 +1,7 @@