From 301308f154ee651b18a89200b10a4912fcd475c9 Mon Sep 17 00:00:00 2001 From: Gleb Rysev <gr00314@surrey.ac.uk> Date: Mon, 10 May 2021 20:13:10 +0100 Subject: [PATCH] Removed unused habit routes --- app/controllers/habits_controller.rb | 13 ++----------- app/views/habits/index.html.erb | 25 ------------------------- app/views/habits/show.html.erb | 4 ---- app/views/habits/show.json.jbuilder | 1 - 4 files changed, 2 insertions(+), 41 deletions(-) delete mode 100644 app/views/habits/index.html.erb delete mode 100644 app/views/habits/show.html.erb delete mode 100644 app/views/habits/show.json.jbuilder diff --git a/app/controllers/habits_controller.rb b/app/controllers/habits_controller.rb index bff9746..6c352ee 100644 --- a/app/controllers/habits_controller.rb +++ b/app/controllers/habits_controller.rb @@ -1,15 +1,6 @@ class HabitsController < ApplicationController - before_action :set_habit, only: [:show, :edit, :update, :destroy, :track] - before_action :user_check, only:[:show,:edit, :update, :destroy, :track] - - # GET /habits or /habits.json - def index - @habits = Habit.all - end - - # GET /habits/1 or /habits/1.json - def show - end + before_action :set_habit, only: [:edit, :update, :destroy, :track] + before_action :user_check, only:[:edit, :update, :destroy, :track] # GET /habits/new def new diff --git a/app/views/habits/index.html.erb b/app/views/habits/index.html.erb deleted file mode 100644 index c81d344..0000000 --- a/app/views/habits/index.html.erb +++ /dev/null @@ -1,25 +0,0 @@ -<p id="notice"><%= notice %></p> - -<h1>Habits</h1> - -<table> - <thead> - <tr> - <th colspan="3"></th> - </tr> - </thead> - - <tbody> - <% @habits.each do |habit| %> - <tr> - <td><%= link_to 'Show', habit %></td> - <td><%= link_to 'Edit', edit_habit_path(habit) %></td> - <td><%= link_to 'Destroy', habit, method: :delete, data: { confirm: t('confirm') } %></td> - </tr> - <% end %> - </tbody> -</table> - -<br> - -<%= link_to 'New Habit', new_habit_path %> diff --git a/app/views/habits/show.html.erb b/app/views/habits/show.html.erb deleted file mode 100644 index 38c33b6..0000000 --- a/app/views/habits/show.html.erb +++ /dev/null @@ -1,4 +0,0 @@ -<p id="notice"><%= notice %></p> - -<%= link_to 'Edit', edit_habit_path(@habit) %> | -<%= link_to 'Back', habits_path %> diff --git a/app/views/habits/show.json.jbuilder b/app/views/habits/show.json.jbuilder deleted file mode 100644 index cfe22e3..0000000 --- a/app/views/habits/show.json.jbuilder +++ /dev/null @@ -1 +0,0 @@ -json.partial! "habits/habit", habit: @habit -- GitLab