Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Done #1114

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Done #1114

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class StatsController < ApplicationController
class Admin::StatsController < ApplicationController #Admin is a module for Rails

def index
@post_count = Post.count
Expand Down
File renamed without changes.
28 changes: 27 additions & 1 deletion config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,33 @@

resources :posts, only: %i[index show new create edit update]

get '/admin/stats', to: 'stats#index'
# get '/admin/stats', to: 'stats#index'
#
# get '/admin/authors/new', to: 'authors#new'
# get '/admin/authors/delete', to: 'authors#delete'
# get '/admin/authors/create', to: 'authors#create'
# get '/admin/comments/moderate', to: 'comments#moderate'

#new code widhout module
# scope '/admin' do
# resources :stats, only: [:index]
# end

#new code widh module
# scope '/admin', module: 'admin' do
# resources :stats, only: [:index]
# end

#When we want to route with a module and use that module's name as the URL prefix,
# we can use the namespace method instead of scope, module.

namespace :admin do
resources :stats, only: [:index]
end





root 'posts#index'
end
Binary file modified db/development.sqlite3
Binary file not shown.
122 changes: 122 additions & 0 deletions log/development.log
Original file line number Diff line number Diff line change
Expand Up @@ -4470,3 +4470,125 @@ 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)
DEPRECATION WARNING: ActiveRecord::Base.raise_in_transactional_callbacks= is deprecated, has no effect and will be removed without replacement. (called from <top (required)> at /home/lauratravin/namespaced-routes-reading-v-000/config/environment.rb:5)
 (4.5ms) CREATE TABLE "ar_internal_metadata" ("key" varchar NOT NULL PRIMARY KEY, "value" varchar, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
ActiveRecord::SchemaMigration Load (0.2ms) SELECT "schema_migrations".* FROM "schema_migrations"
Post Load (0.2ms) SELECT "posts".* FROM "posts"
 (0.1ms) begin transaction
SQL (0.5ms) DELETE FROM "posts" WHERE "posts"."id" = ? [["id", 1]]
 (2.4ms) commit transaction
 (0.0ms) begin transaction
SQL (0.2ms) DELETE FROM "posts" WHERE "posts"."id" = ? [["id", 2]]
 (1.4ms) commit transaction
 (0.0ms) begin transaction
SQL (0.1ms) DELETE FROM "posts" WHERE "posts"."id" = ? [["id", 3]]
 (1.4ms) commit transaction
Author Load (0.2ms) SELECT "authors".* FROM "authors"
 (0.1ms) begin transaction
SQL (0.2ms) DELETE FROM "authors" WHERE "authors"."id" = ? [["id", 1]]
 (1.7ms) commit transaction
 (0.0ms) begin transaction
SQL (0.4ms) DELETE FROM "authors" WHERE "authors"."id" = ? [["id", 2]]
 (1.8ms) commit transaction
 (0.0ms) begin transaction
SQL (0.2ms) DELETE FROM "authors" WHERE "authors"."id" = ? [["id", 3]]
 (1.4ms) commit transaction
 (0.1ms) begin transaction
SQL (0.2ms) INSERT INTO "authors" ("name", "genre", "bio", "created_at", "updated_at") VALUES (?, ?, ?, ?, ?) [["name", "Stephen King"], ["genre", "Romance"], ["bio", "Writes a lot of scary things."], ["created_at", "2021-03-28 20:29:22.935387"], ["updated_at", "2021-03-28 20:29:22.935387"]]
 (1.6ms) commit transaction
 (0.0ms) begin transaction
SQL (0.4ms) INSERT INTO "authors" ("name", "genre", "bio", "created_at", "updated_at") VALUES (?, ?, ?, ?, ?) [["name", "Ariana Huffington"], ["genre", "Comedy"], ["bio", "Up and comer. One to watch."], ["created_at", "2021-03-28 20:29:22.940376"], ["updated_at", "2021-03-28 20:29:22.940376"]]
 (1.4ms) commit transaction
 (0.0ms) begin transaction
SQL (0.4ms) INSERT INTO "authors" ("name", "genre", "bio", "created_at", "updated_at") VALUES (?, ?, ?, ?, ?) [["name", "Horse Ebooks"], ["genre", "?????"], ["bio", "Eclectic."], ["created_at", "2021-03-28 20:29:22.944047"], ["updated_at", "2021-03-28 20:29:22.944047"]]
 (1.1ms) commit transaction
 (0.1ms) begin transaction
SQL (0.3ms) INSERT INTO "posts" ("title", "description", "created_at", "updated_at", "author_id") VALUES (?, ?, ?, ?, ?) [["title", "Something About Democrats"], ["description", " Last night I dreamt there is more to life than to bully friends.\n What has that got to do with Democrats, you probably wonder...\n The answer is here. Right here. Back in school my hair was silly.\n Nevermind about the details, but... In a nut-shell: And still,\n it was strange. Using Google, I found a 12-sided dice.\n Which would be nothing special but...\n"], ["created_at", "2021-03-28 20:29:22.956584"], ["updated_at", "2021-03-28 20:29:22.956584"], ["author_id", 4]]
 (1.7ms) commit transaction
 (0.0ms) begin transaction
SQL (0.3ms) INSERT INTO "posts" ("title", "description", "created_at", "updated_at", "author_id") VALUES (?, ?, ?, ?, ?) [["title", "Spam Spam Spam"], ["description", " It occurred to me that no matter what cards you are dealt,\n you need to enjoy the small joys. How is this related to Spam, you ask.\n Fair enough. OK, I will tell you something here now...\n Sometime around last year I loved movies. Yeah, just what it sounds like.\n In a nut-shell: And still, it was strange. I collided with the powers of a my computer,\n broken and gray. And here's why this matters...\n"], ["created_at", "2021-03-28 20:29:22.961462"], ["updated_at", "2021-03-28 20:29:22.961462"], ["author_id", 5]]
 (1.2ms) commit transaction
 (0.1ms) begin transaction
SQL (0.4ms) INSERT INTO "posts" ("title", "description", "created_at", "updated_at", "author_id") VALUES (?, ?, ?, ?, ?) [["title", "Links! Click Links!"], ["description", " Last night I dreamt we simply need to realize to be so competitive.\n Does the responsibility lie with Links, you probably wonder...\n The answer is here. Right here. About the time I broke up with my\n ex I was totally into music. Whatever. So that's that.\n But something wasn't right. I stumbled upon a giant banana.\n"], ["created_at", "2021-03-28 20:29:22.966412"], ["updated_at", "2021-03-28 20:29:22.966412"], ["author_id", 6]]
 (1.5ms) commit transaction
 (0.0ms) begin transaction
SQL (0.3ms) UPDATE "posts" SET "created_at" = ?, "updated_at" = ? WHERE "posts"."id" = ? [["created_at", "2021-03-27 00:00:00"], ["updated_at", "2021-03-28 20:29:22.971831"], ["id", 6]]
 (1.3ms) commit transaction
DEPRECATION WARNING: ActiveRecord::Base.raise_in_transactional_callbacks= is deprecated, has no effect and will be removed without replacement. (called from <top (required)> at /home/lauratravin/namespaced-routes-reading-v-000/config/environment.rb:5)
Started GET "/" for 173.77.183.241 at 2021-03-28 20:29:55 +0000
Cannot render console from 173.77.183.241! Allowed networks: 127.0.0.1, ::1, 127.0.0.0/127.255.255.255
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.2ms) SELECT "authors".* FROM "authors" WHERE "authors"."id" = ? LIMIT ? [["id", 4], ["LIMIT", 1]]
Author Load (0.2ms) SELECT "authors".* FROM "authors" WHERE "authors"."id" = ? LIMIT ? [["id", 5], ["LIMIT", 1]]
Author Load (0.1ms) SELECT "authors".* FROM "authors" WHERE "authors"."id" = ? LIMIT ? [["id", 6], ["LIMIT", 1]]
Rendered posts/index.html.erb within layouts/application (67.6ms)
Completed 200 OK in 624ms (Views: 606.5ms | ActiveRecord: 1.5ms)


Started GET "/assets/authors.self-e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855.css?body=1" for 173.77.183.241 at 2021-03-28 20:29:56 +0000
Cannot render console from 173.77.183.241! Allowed networks: 127.0.0.1, ::1, 127.0.0.0/127.255.255.255
Started GET "/assets/application.self-e80e8f2318043e8af94dddc2adad5a4f09739a8ebb323b3ab31cd71d45fd9113.css?body=1" for 173.77.183.241 at 2021-03-28 20:29:56 +0000
Cannot render console from 173.77.183.241! Allowed networks: 127.0.0.1, ::1, 127.0.0.0/127.255.255.255
Started GET "/assets/jquery.self-bd7ddd393353a8d2480a622e80342adf488fb6006d667e8b42e4c0073393abee.js?body=1" for 173.77.183.241 at 2021-03-28 20:29:56 +0000
Cannot render console from 173.77.183.241! Allowed networks: 127.0.0.1, ::1, 127.0.0.0/127.255.255.255
Started GET "/assets/jquery_ujs.self-784a997f6726036b1993eb2217c9cb558e1cbb801c6da88105588c56f13b466a.js?body=1" for 173.77.183.241 at 2021-03-28 20:29:56 +0000
Cannot render console from 173.77.183.241! Allowed networks: 127.0.0.1, ::1, 127.0.0.0/127.255.255.255
Started GET "/assets/turbolinks.self-569ee74eaa15c1e2019317ff770b8769b1ec033a0f572a485f64c82ddc8f989e.js?body=1" for 173.77.183.241 at 2021-03-28 20:29:56 +0000
Cannot render console from 173.77.183.241! Allowed networks: 127.0.0.1, ::1, 127.0.0.0/127.255.255.255
Started GET "/assets/authors.self-877aef30ae1b040ab8a3aba4e3e309a11d7f2612f44dde450b5c157aa5f95c05.js?body=1" for 173.77.183.241 at 2021-03-28 20:29:56 +0000
Cannot render console from 173.77.183.241! Allowed networks: 127.0.0.1, ::1, 127.0.0.0/127.255.255.255
Started GET "/assets/application.self-3b8dabdc891efe46b9a144b400ad69e37d7e5876bdc39dee783419a69d7ca819.js?body=1" for 173.77.183.241 at 2021-03-28 20:29:56 +0000
Cannot render console from 173.77.183.241! Allowed networks: 127.0.0.1, ::1, 127.0.0.0/127.255.255.255
Started GET "/admin" for 173.77.183.241 at 2021-03-28 20:30:02 +0000
Cannot render console from 173.77.183.241! Allowed networks: 127.0.0.1, ::1, 127.0.0.0/127.255.255.255

ActionController::RoutingError (No route matches [GET] "/admin"):

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:20: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'
/usr/local/rvm/rubies/ruby-2.6.1/lib/ruby/2.6.0/webrick/httpserver.rb:140:in `service'
/usr/local/rvm/rubies/ruby-2.6.1/lib/ruby/2.6.0/webrick/httpserver.rb:96:in `run'
/usr/local/rvm/rubies/ruby-2.6.1/lib/ruby/2.6.0/webrick/server.rb:307:in `block in start_thread'
Rendering /usr/local/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 /usr/local/rvm/gems/ruby-2.6.1/gems/actionpack-5.0.7.2/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb
Rendered /usr/local/rvm/gems/ruby-2.6.1/gems/actionpack-5.0.7.2/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb (3.4ms)
Rendered collection of /usr/local/rvm/gems/ruby-2.6.1/gems/actionpack-5.0.7.2/lib/action_dispatch/middleware/templates/routes/_route.html.erb [15 times] (5.9ms)
Rendered /usr/local/rvm/gems/ruby-2.6.1/gems/actionpack-5.0.7.2/lib/action_dispatch/middleware/templates/routes/_table.html.erb (14.1ms)
Rendering /usr/local/rvm/gems/ruby-2.6.1/gems/actionpack-5.0.7.2/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb
Rendered /usr/local/rvm/gems/ruby-2.6.1/gems/actionpack-5.0.7.2/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb (1.4ms)
Rendered /usr/local/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 (66.4ms)
Started GET "/admin/stats" for 173.77.183.241 at 2021-03-28 20:30:10 +0000
Cannot render console from 173.77.183.241! Allowed networks: 127.0.0.1, ::1, 127.0.0.0/127.255.255.255
Processing by Admin::StatsController#index as HTML
 (0.7ms) 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 (1.9ms)
Completed 200 OK in 49ms (Views: 41.5ms | ActiveRecord: 1.0ms)


DEPRECATION WARNING: ActiveRecord::Base.raise_in_transactional_callbacks= is deprecated, has no effect and will be removed without replacement. (called from <top (required)> at /home/lauratravin/namespaced-routes-reading-v-000/config/environment.rb:5)
DEPRECATION WARNING: ActiveRecord::Base.raise_in_transactional_callbacks= is deprecated, has no effect and will be removed without replacement. (called from <top (required)> at /home/lauratravin/namespaced-routes-reading-v-000/config/environment.rb:5)
DEPRECATION WARNING: ActiveRecord::Base.raise_in_transactional_callbacks= is deprecated, has no effect and will be removed without replacement. (called from <top (required)> at /home/lauratravin/namespaced-routes-reading-v-000/config/environment.rb:5)
1 change: 0 additions & 1 deletion tmp/pids/server.pid

This file was deleted.