Getting Started

Let's learn about the model-view-controller pattern and how to test Rails elements in the best possible way.

Model-view-controller (MVC) diagram

Rails applications have a specific structure, which starts with the model-view-controller (MVC) pattern. The view layer is responsible for presenting data to the user, a server-side web application that usually means generating HTML. Ideally, the view layer does this with minimal interaction with the model. The controller takes in information about the user request, contacts the appropriate parts of the model layer for data, and passes that information to the view layer. The following is a simplified diagram of this pattern.

Get hands-on with 1200+ tech skills courses.