From 4ab4a0a6d8cd5b671a4ab63e8985914e1670bf17 Mon Sep 17 00:00:00 2001 From: klovae Date: Thu, 23 Jul 2020 16:59:31 -0400 Subject: [PATCH] Done. --- .../{ => admin}/stats_controller.rb | 2 +- app/views/{ => admin}/stats/index.html.erb | 0 config/routes.rb | 4 +- log/development.log | 93 +++++++++++++++++++ tmp/pids/server.pid | 1 - 5 files changed, 97 insertions(+), 3 deletions(-) rename app/controllers/{ => admin}/stats_controller.rb (68%) rename app/views/{ => admin}/stats/index.html.erb (100%) delete mode 100644 tmp/pids/server.pid 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 diff --git a/log/development.log b/log/development.log index c60621744..2c085e53c 100644 --- a/log/development.log +++ b/log/development.log @@ -4470,3 +4470,96 @@ ActionController::RoutingError (No route matches [GET] "/stats"): Rendered /Users/scottcreynolds/.rvm/gems/ruby-2.1.2/gems/web-console-2.2.1/lib/web_console/templates/main.js.erb within layouts/javascript (0.2ms) Rendered /Users/scottcreynolds/.rvm/gems/ruby-2.1.2/gems/web-console-2.2.1/lib/web_console/templates/error_page.js.erb within layouts/javascript (0.4ms) Rendered /Users/scottcreynolds/.rvm/gems/ruby-2.1.2/gems/web-console-2.2.1/lib/web_console/templates/index.html.erb (34.6ms) +Started GET "/admin/stats" for 127.0.0.1 at 2020-07-23 16:41:28 -0400 +DEPRECATION WARNING: ActiveRecord::Base.raise_in_transactional_callbacks= is deprecated, has no effect and will be removed without replacement. (called from block (3 levels) in at /home/swagglerock/.rvm/gems/ruby-2.6.1/gems/activerecord-5.0.7.2/lib/active_record/railtie.rb:113) + ActiveRecord::SchemaMigration Load (7.4ms) SELECT "schema_migrations".* FROM "schema_migrations" +Processing by StatsController#index as HTML +  (0.1ms) SELECT COUNT(*) FROM "posts" +  (0.1ms) SELECT COUNT(*) FROM "authors" + Post Load (0.1ms) SELECT "posts".* FROM "posts" ORDER BY "posts"."id" DESC LIMIT ? [["LIMIT", 1]] + Rendering stats/index.html.erb within layouts/application + Rendered stats/index.html.erb within layouts/application (6.0ms) +Completed 200 OK in 1495ms (Views: 1447.7ms | ActiveRecord: 1.2ms) + + +Started GET "/assets/authors.self-e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855.css?body=1" for 127.0.0.1 at 2020-07-23 16:41:30 -0400 +Started GET "/assets/jquery.self-bd7ddd393353a8d2480a622e80342adf488fb6006d667e8b42e4c0073393abee.js?body=1" for 127.0.0.1 at 2020-07-23 16:41:30 -0400 +Started GET "/assets/jquery_ujs.self-784a997f6726036b1993eb2217c9cb558e1cbb801c6da88105588c56f13b466a.js?body=1" for 127.0.0.1 at 2020-07-23 16:41:30 -0400 +Started GET "/assets/turbolinks.self-569ee74eaa15c1e2019317ff770b8769b1ec033a0f572a485f64c82ddc8f989e.js?body=1" for 127.0.0.1 at 2020-07-23 16:41:30 -0400 +Started GET "/assets/authors.self-877aef30ae1b040ab8a3aba4e3e309a11d7f2612f44dde450b5c157aa5f95c05.js?body=1" for 127.0.0.1 at 2020-07-23 16:41:30 -0400 +Started GET "/assets/application.self-3b8dabdc891efe46b9a144b400ad69e37d7e5876bdc39dee783419a69d7ca819.js?body=1" for 127.0.0.1 at 2020-07-23 16:41:30 -0400 +Started GET "/stats" for 127.0.0.1 at 2020-07-23 16:41:52 -0400 + +ActionController::RoutingError (No route matches [GET] "/stats"): + +actionpack (5.0.7.2) lib/action_dispatch/middleware/debug_exceptions.rb:53:in `call' +web-console (2.3.0) lib/web_console/middleware.rb:28:in `block in call' +web-console (2.3.0) lib/web_console/middleware.rb:18:in `catch' +web-console (2.3.0) lib/web_console/middleware.rb:18:in `call' +actionpack (5.0.7.2) lib/action_dispatch/middleware/show_exceptions.rb:31:in `call' +railties (5.0.7.2) lib/rails/rack/logger.rb:36:in `call_app' +railties (5.0.7.2) lib/rails/rack/logger.rb:24:in `block in call' +activesupport (5.0.7.2) lib/active_support/tagged_logging.rb:69:in `block in tagged' +activesupport (5.0.7.2) lib/active_support/tagged_logging.rb:26:in `tagged' +activesupport (5.0.7.2) lib/active_support/tagged_logging.rb:69:in `tagged' +railties (5.0.7.2) lib/rails/rack/logger.rb:24:in `call' +actionpack (5.0.7.2) lib/action_dispatch/middleware/request_id.rb:24:in `call' +rack (2.2.3) lib/rack/method_override.rb:24:in `call' +rack (2.2.3) lib/rack/runtime.rb:22:in `call' +activesupport (5.0.7.2) lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call' +actionpack (5.0.7.2) lib/action_dispatch/middleware/executor.rb:12:in `call' +actionpack (5.0.7.2) lib/action_dispatch/middleware/static.rb:136:in `call' +rack (2.2.3) lib/rack/sendfile.rb:110:in `call' +railties (5.0.7.2) lib/rails/engine.rb:522:in `call' +rack (2.2.3) lib/rack/handler/webrick.rb:95:in `service' +/home/swagglerock/.rvm/rubies/ruby-2.6.1/lib/ruby/2.6.0/webrick/httpserver.rb:140:in `service' +/home/swagglerock/.rvm/rubies/ruby-2.6.1/lib/ruby/2.6.0/webrick/httpserver.rb:96:in `run' +/home/swagglerock/.rvm/rubies/ruby-2.6.1/lib/ruby/2.6.0/webrick/server.rb:307:in `block in start_thread' + Rendering /home/swagglerock/.rvm/gems/ruby-2.6.1/gems/actionpack-5.0.7.2/lib/action_dispatch/middleware/templates/rescues/routing_error.html.erb within rescues/layout + Rendering /home/swagglerock/.rvm/gems/ruby-2.6.1/gems/actionpack-5.0.7.2/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb + Rendered /home/swagglerock/.rvm/gems/ruby-2.6.1/gems/actionpack-5.0.7.2/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb (0.7ms) + Rendered collection of /home/swagglerock/.rvm/gems/ruby-2.6.1/gems/actionpack-5.0.7.2/lib/action_dispatch/middleware/templates/routes/_route.html.erb [15 times] (10.3ms) + Rendered /home/swagglerock/.rvm/gems/ruby-2.6.1/gems/actionpack-5.0.7.2/lib/action_dispatch/middleware/templates/routes/_table.html.erb (30.1ms) + Rendering /home/swagglerock/.rvm/gems/ruby-2.6.1/gems/actionpack-5.0.7.2/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb + Rendered /home/swagglerock/.rvm/gems/ruby-2.6.1/gems/actionpack-5.0.7.2/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb (4.7ms) + Rendered /home/swagglerock/.rvm/gems/ruby-2.6.1/gems/actionpack-5.0.7.2/lib/action_dispatch/middleware/templates/rescues/routing_error.html.erb within rescues/layout (146.7ms) +DEPRECATION WARNING: Accessing mime types via constants is deprecated. Please change `Mime::HTML` to `Mime[:html]`. (called from acceptable_content_type? at /home/swagglerock/.rvm/gems/ruby-2.6.1/gems/web-console-2.3.0/lib/web_console/middleware.rb:58) + Rendering /home/swagglerock/.rvm/gems/ruby-2.6.1/gems/web-console-2.3.0/lib/web_console/templates/index.html.erb + Rendered /home/swagglerock/.rvm/gems/ruby-2.6.1/gems/web-console-2.3.0/lib/web_console/templates/_markup.html.erb (0.5ms) + Rendering /home/swagglerock/.rvm/gems/ruby-2.6.1/gems/web-console-2.3.0/lib/web_console/templates/console.js.erb within layouts/javascript + Rendering /home/swagglerock/.rvm/gems/ruby-2.6.1/gems/web-console-2.3.0/lib/web_console/templates/_inner_console_markup.html.erb within layouts/inlined_string + Rendered /home/swagglerock/.rvm/gems/ruby-2.6.1/gems/web-console-2.3.0/lib/web_console/templates/_inner_console_markup.html.erb within layouts/inlined_string (0.4ms) + Rendering /home/swagglerock/.rvm/gems/ruby-2.6.1/gems/web-console-2.3.0/lib/web_console/templates/_prompt_box_markup.html.erb within layouts/inlined_string + Rendered /home/swagglerock/.rvm/gems/ruby-2.6.1/gems/web-console-2.3.0/lib/web_console/templates/_prompt_box_markup.html.erb within layouts/inlined_string (0.2ms) + Rendering /home/swagglerock/.rvm/gems/ruby-2.6.1/gems/web-console-2.3.0/lib/web_console/templates/style.css.erb within layouts/inlined_string + Rendered /home/swagglerock/.rvm/gems/ruby-2.6.1/gems/web-console-2.3.0/lib/web_console/templates/style.css.erb within layouts/inlined_string (0.2ms) +DEPRECATION WARNING: Accessing mime types via constants is deprecated. Please change `Mime::WEB_CONSOLE_V2` to `Mime[:web_console_v2]`. (called from __home_swagglerock__rvm_gems_ruby_______gems_web_console_______lib_web_console_templates_console_js_erb___3836178539162538884_69833091441820 at /home/swagglerock/.rvm/gems/ruby-2.6.1/gems/web-console-2.3.0/lib/web_console/templates/console.js.erb:491) + Rendered /home/swagglerock/.rvm/gems/ruby-2.6.1/gems/web-console-2.3.0/lib/web_console/templates/console.js.erb within layouts/javascript (67.8ms) + Rendering /home/swagglerock/.rvm/gems/ruby-2.6.1/gems/web-console-2.3.0/lib/web_console/templates/main.js.erb within layouts/javascript + Rendered /home/swagglerock/.rvm/gems/ruby-2.6.1/gems/web-console-2.3.0/lib/web_console/templates/main.js.erb within layouts/javascript (0.2ms) + Rendering /home/swagglerock/.rvm/gems/ruby-2.6.1/gems/web-console-2.3.0/lib/web_console/templates/error_page.js.erb within layouts/javascript + Rendered /home/swagglerock/.rvm/gems/ruby-2.6.1/gems/web-console-2.3.0/lib/web_console/templates/error_page.js.erb within layouts/javascript (0.3ms) + Rendered /home/swagglerock/.rvm/gems/ruby-2.6.1/gems/web-console-2.3.0/lib/web_console/templates/index.html.erb (135.1ms) +Started GET "/posts" for 127.0.0.1 at 2020-07-23 16:57:36 -0400 +DEPRECATION WARNING: ActiveRecord::Base.raise_in_transactional_callbacks= is deprecated, has no effect and will be removed without replacement. (called from block (3 levels) in at /home/swagglerock/.rvm/gems/ruby-2.6.1/gems/activerecord-5.0.7.2/lib/active_record/railtie.rb:113) + ActiveRecord::SchemaMigration Load (0.2ms) SELECT "schema_migrations".* FROM "schema_migrations" +Processing by PostsController#index as HTML + Rendering posts/index.html.erb within layouts/application + Post Load (0.2ms) SELECT "posts".* FROM "posts" + Author Load (0.1ms) SELECT "authors".* FROM "authors" WHERE "authors"."id" = ? LIMIT ? [["id", 1], ["LIMIT", 1]] + Author Load (0.1ms) SELECT "authors".* FROM "authors" WHERE "authors"."id" = ? LIMIT ? [["id", 2], ["LIMIT", 1]] + Author Load (0.1ms) SELECT "authors".* FROM "authors" WHERE "authors"."id" = ? LIMIT ? [["id", 3], ["LIMIT", 1]] + Rendered posts/index.html.erb within layouts/application (64.1ms) +Completed 200 OK in 351ms (Views: 333.9ms | ActiveRecord: 1.6ms) + + +Started GET "/admin/stats" for 127.0.0.1 at 2020-07-23 16:57:47 -0400 +Processing by Admin::StatsController#index as HTML +  (0.2ms) SELECT COUNT(*) FROM "posts" +  (0.1ms) SELECT COUNT(*) FROM "authors" + Post Load (0.2ms) SELECT "posts".* FROM "posts" ORDER BY "posts"."id" DESC LIMIT ? [["LIMIT", 1]] + Rendering admin/stats/index.html.erb within layouts/application + Rendered admin/stats/index.html.erb within layouts/application (0.5ms) +Completed 200 OK in 70ms (Views: 60.8ms | ActiveRecord: 0.4ms) + + diff --git a/tmp/pids/server.pid b/tmp/pids/server.pid deleted file mode 100644 index 1ca13651f..000000000 --- a/tmp/pids/server.pid +++ /dev/null @@ -1 +0,0 @@ -33801 \ No newline at end of file