main controller instead of welcome
This commit is contained in:
@@ -1,2 +1,7 @@
|
|||||||
class ApplicationController < ActionController::Base
|
class ApplicationController < ActionController::Base
|
||||||
|
around_action do |_, action|
|
||||||
|
logger.measure_error "Took too long to complete, please review your code as asynchronous task", min_duration: 3000 do
|
||||||
|
action.call
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
class MainController < ApplicationController
|
||||||
|
def home
|
||||||
|
end
|
||||||
|
|
||||||
|
def about
|
||||||
|
logger.debug "some debugging info"
|
||||||
|
logger.info "efficient logging for dark theme"
|
||||||
|
logger.warn "a warning"
|
||||||
|
logger.error "an error"
|
||||||
|
sleep 3
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
class WelcomeController < ApplicationController
|
|
||||||
def index
|
|
||||||
# logger.measure_error "Took too long to complete", min_duration: 3000 do
|
|
||||||
# logger.debug("Debugging information to aid with problem determination")
|
|
||||||
# logger.info("Informational message such as request received\nline 2\nline3")
|
|
||||||
# logger.warn("Warn about something in the system")
|
|
||||||
# logger.error("An error occurred during processing")
|
|
||||||
# logger.fatal("Oh no something really bad happened")
|
|
||||||
|
|
||||||
# logger.measure_info "Called external interface" do
|
|
||||||
# sleep 0.1 # Code to call external service ...
|
|
||||||
# end
|
|
||||||
|
|
||||||
# SemanticLogger.tagged(user: "Jack", zip_code: 12345) do
|
|
||||||
# # All log entries in this block will include the above named tags
|
|
||||||
# logger.debug("Hello World")
|
|
||||||
# end
|
|
||||||
|
|
||||||
logger.info("efficient logging for dark theme")
|
|
||||||
# raise "exception"
|
|
||||||
# end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
module MainHelper
|
||||||
|
end
|
||||||
@@ -9,6 +9,10 @@
|
|||||||
<%= javascript_importmap_tags %>
|
<%= javascript_importmap_tags %>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
<nav>
|
||||||
|
<%= link_to 'home', :root %>
|
||||||
|
<%= link_to 'about', main_about_path %>
|
||||||
|
</nav>
|
||||||
<%= yield %>
|
<%= yield %>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -0,0 +1,2 @@
|
|||||||
|
<h1>Main#about</h1>
|
||||||
|
<p>Find me in app/views/main/about.html.erb</p>
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
<h1>Main#home</h1>
|
||||||
|
<p>Find me in app/views/main/home.html.erb</p>
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
<h1>Welcome Aboard</h1>
|
|
||||||
<ul>
|
|
||||||
<li>Rails 7</li>
|
|
||||||
<li>Efficient Logging for dark theme</li>
|
|
||||||
</ul>
|
|
||||||
+3
-1
@@ -1,3 +1,5 @@
|
|||||||
Rails.application.routes.draw do
|
Rails.application.routes.draw do
|
||||||
root "welcome#index"
|
root "main#home"
|
||||||
|
|
||||||
|
get "main/about"
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
require "test_helper"
|
||||||
|
|
||||||
|
class MainControllerTest < ActionDispatch::IntegrationTest
|
||||||
|
test "should get home" do
|
||||||
|
get main_home_url
|
||||||
|
assert_response :success
|
||||||
|
end
|
||||||
|
|
||||||
|
test "should get about" do
|
||||||
|
get main_about_url
|
||||||
|
assert_response :success
|
||||||
|
end
|
||||||
|
end
|
||||||
Reference in New Issue
Block a user