Please explain request/response cycle?

Submitted by: Muhammad
Let's explain request/response flow in Rails:

☛ The user opens their browser and enters a URL.
☛ The browser sends a GET request to the URL. The request hits the Rails Router (config/routes.rb).
☛ The router receives the request information from the web server and based on that, decides which controller action should be called. If a request matches to any path in the routes file, the corresponding controller and action will be called.
☛ The controller receives the parameters from the router and passes them into appropriate model methods.
☛ The model queries a database to fetch data.
☛ The Database returns stored data to the model.
☛ The model manages the data and returns it to the controller.
☛ The controller feeds the received data to the view.
☛ The view renders the page as HTML, prepares a response and forwards it to the controller.
☛ The controller forwards the ready response to the browser.
☛ The browser displays a response to the user.
Submitted by: Muhammad

Read Online Ruby on Rails Developer Job Interview Questions And Answers