I’m learning RoR and two different sources describe the the View’s relationship with the browser somewhat differently. One source describes the Controller as returning requests to the browser after interacting with the View. Another source describes the View as returning requests directly to the browser after receiving instructions from the Controller. So should I understand the Controller to be between the browser and the View or does the View come between the Controller and the browser?
I’m learning RoR and two different sources describe the the View’s relationship with the
Share
I think both interpretations are partly right and partly wrong since they’re both gross simplifications.
When a request is passed to the controller, it executes the method that corresponds to the action that’s been requested. One of the things done by that method is to render the view — that’s what the call the
renderdoes. If you don’t explicitly call render, it’s called for you with the default params. Neither one is really “between” the other and the browser, but the controller is capable of responding to requests on its own, and the view is not.