From 727a73a80f029ed37260f297d6091f0995bb883c Mon Sep 17 00:00:00 2001 From: Sophie Gu Date: Thu, 24 Dec 2020 04:16:26 +0000 Subject: [PATCH] Done. --- app/controllers/{ => admin}/stats_controller.rb | 2 +- app/views/{ => admin}/stats/index.html.erb | 0 config/routes.rb | 4 +++- 3 files changed, 4 insertions(+), 2 deletions(-) rename app/controllers/{ => admin}/stats_controller.rb (68%) rename app/views/{ => admin}/stats/index.html.erb (100%) diff --git a/app/controllers/stats_controller.rb b/app/controllers/admin/stats_controller.rb similarity index 68% rename from app/controllers/stats_controller.rb rename to app/controllers/admin/stats_controller.rb index d155f327b..8b71e2a34 100644 --- a/app/controllers/stats_controller.rb +++ b/app/controllers/admin/stats_controller.rb @@ -1,4 +1,4 @@ -class StatsController < ApplicationController +class Admin::StatsController < ApplicationController def index @post_count = Post.count diff --git a/app/views/stats/index.html.erb b/app/views/admin/stats/index.html.erb similarity index 100% rename from app/views/stats/index.html.erb rename to app/views/admin/stats/index.html.erb diff --git a/config/routes.rb b/config/routes.rb index 66d8f171b..9111a38e6 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -5,7 +5,9 @@ resources :posts, only: %i[index show new create edit update] - get '/admin/stats', to: 'stats#index' + namespace :admin do + resources :stats, only: [:index] + end root 'posts#index' end