Skip Navigation

Mark Miyashita

negativetwelve

Student, Software Engineer, Teacher, Aspiring Entrepreneur

Rails Walkthrough

By: Mark Miyashita

Chapter 1 - Introduction and Purpose

1.1 Introduction

1.1.1

1.1.2

1.2

Chapter 2 - Models, Views, and Controllers

2.1 MVC - An Idea

What is MVC? MVC stands for Model, View, Controller, and it’s the idea that we want to separate our code into sections that represent different parts of our application. Popular web applications separate into three main components. First off, we have our models which represent the brains within our application.

Models are like objects in which they have attributes and methods that work to edit and recall data stored within the object. Between objects, there can be correspondances between them such as one-to-one, many-to-one, or, many-to-many relationships. These can be thought up of as relationships between actual objects such as a parent having many children.

Views are what show the data to the users of your web application. Once you find a user and get all of the attributes, you show it to the user using the view. Views are generally templated using a markup of some sort. We’ll learn all about this later on.

Controllers are the link between the two. Requests come in and they are processed by figuring out which method is called in the controller. The controller then links together and gets whatever data it needs processed from the model where it is finally gathered and redisplayed in the view for the user to interact with again.

2.1.1 Models

2.1.2 Views

2.1.3 Controllers

Chapter 3 - Setting Up Our First App

3.1