request-response cycle of ruby on rails app
DESCRIPTION
This presentation describes the Request-Response cycle that a Ruby on Rails app goes through, narrowing in from a high level to a low level, and back.TRANSCRIPT
![Page 1: Request-Response Cycle of Ruby on Rails App](https://reader033.vdocuments.net/reader033/viewer/2022051610/5482cd5fb07959240c8b48d1/html5/thumbnails/1.jpg)
Request-‐ResponseRuby on Rails
Nathalie Steinmetz http://github.com/natsteinmetz
http://linkedin.com/in/nathaliesteinmetz
![Page 2: Request-Response Cycle of Ruby on Rails App](https://reader033.vdocuments.net/reader033/viewer/2022051610/5482cd5fb07959240c8b48d1/html5/thumbnails/2.jpg)
User Browser DNS Server
(1) DNS Lookup (http://codefellows.org)
(2) IP Address
Web Server (for example Apache)
(3) HTTP Request [URI] (http://codefellows.org) [method] (GET) [request header] (user agent, etc.)
Application Server (for example Phusion Passenger)
(4) Recognized Ruby application request – forward to app server
HIGH LEVEL
![Page 3: Request-Response Cycle of Ruby on Rails App](https://reader033.vdocuments.net/reader033/viewer/2022051610/5482cd5fb07959240c8b48d1/html5/thumbnails/3.jpg)
Ruby Version Manager
Gemfile
Rails Routes
(5) Go to RVM
(6) Check Rails version in Gemfile
(7) Check routes using HTTP request URI and method
MI D LEVEL
![Page 4: Request-Response Cycle of Ruby on Rails App](https://reader033.vdocuments.net/reader033/viewer/2022051610/5482cd5fb07959240c8b48d1/html5/thumbnails/4.jpg)
LOW LEVEL
Controller
Model
View
(9) Go to Model, get data from database
(8) Go to appropriate controller (index)
Controller
(10) Return to controller
(11) Compile response body (HTML)
![Page 5: Request-Response Cycle of Ruby on Rails App](https://reader033.vdocuments.net/reader033/viewer/2022051610/5482cd5fb07959240c8b48d1/html5/thumbnails/5.jpg)
Application Server (for example Phusion Passenger)
HIGH LEVEL Web Server (for example Apache) User Browser
(14) Render view
(12) Send HTTP Response to app server [Status code] (200) [Response header] (cookie, etc.) [Response body] (HTML, CSS, Javascript)
(13) Forward HTTP Response
Repeat for linked files (CSS, images, etc.)