@@ -468,7 +468,9 @@ module Rails
468
468
end
469
469
```
470
470
471
- As we see in the Rack middleware stack, the last one is ` @app=#<ActionDispatch::Routing::RouteSet:0x00007fa1e594cbe8> `
471
+ As we see in the Rack middleware stack, the last one is
472
+
473
+ ` @app=#<ActionDispatch::Routing::RouteSet:0x00007fa1e594cbe8> `
472
474
``` ruby
473
475
# ./gems/actionpack5.2.2/lib/action_dispatch/routing/route_set.rb
474
476
module ActionDispatch
@@ -570,7 +572,8 @@ module ActionDispatch
570
572
def serve (req )
571
573
params = req.path_parameters # params: { action: 'index', controller: 'home' }
572
574
controller = controller(req) # controller: HomeController
573
- res = controller.make_response!(req) # The definition of make_response! is ActionDispatch::Response.create.tap do |res| res.request = request; end
575
+ # The definition of make_response! is ActionDispatch::Response.create.tap do |res| res.request = request; end
576
+ res = controller.make_response!(req)
574
577
dispatch(controller, params[:action ], req, res) # Let's step into this line.
575
578
rescue ActionController ::RoutingError
576
579
if @raise_on_name_error
@@ -1143,7 +1146,7 @@ end
1143
1146
1144
1147
It's time to answer the question before:
1145
1148
1146
- How can this instance variable defined ' @users ' in HomeController be accessed in ' ./app/views/home/index.html.erb' ?
1149
+ How can instance variable like ` @users ` defined in ` HomeController ` be accessed in ` ./app/views/home/index.html.erb ` ?
1147
1150
1148
1151
``` ruby
1149
1152
# ./gems/actionview-5.2.2/lib/action_view/rendering.rb
@@ -1236,7 +1239,7 @@ end
1236
1239
1237
1240
```
1238
1241
1239
- ## Part 4: What ` $ rails server ` do?
1242
+ ## Part 4: What does ` $ rails server ` do?
1240
1243
Assume your rails project app class name is ` YourProject::Application ` (defined in ` ./config/application.rb ` ).
1241
1244
1242
1245
First, I will give you a piece of important code.
@@ -1268,7 +1271,7 @@ module Rails
1268
1271
end
1269
1272
```
1270
1273
1271
- Then, Let 's start rails by ` rails server ` . The command ` rails ` locates at ` ./bin/ ` .
1274
+ Then, let 's start rails by ` rails server ` . The command ` rails ` locates at ` ./bin/ ` .
1272
1275
``` ruby
1273
1276
# !/usr/bin/env ruby
1274
1277
APP_PATH = File .expand_path(' ../config/application' , __dir__ )
@@ -1591,6 +1594,6 @@ module Rack
1591
1594
end
1592
1595
end
1593
1596
```
1594
- Now puma has been started successfully running your app (instance of YourProject::Application).
1597
+ Now puma has been started successfully with your app (instance of YourProject::Application) running .
1595
1598
1596
1599
0 commit comments