Rails Flashcards

1
Q

What does MVC stand for?

A

Model View Controller is a predictable software design pattern that is popularly used to design web applications and mobile apps.
The MVC design pattern serves to separate the presentation layer from the business logic. The Model View Controller design pattern separates concerns into one of 3 buckets:
Model
View
Controller
Model: stores & manages data.
Often a database, in our quick example we’ll use local web storage on a browser to illustrate the concept.

View: Graphical User Interface
The view is a visual representation of the data- like a chart, diagram, table, form.

The view contains all functionality that directly interacts with the user - like clicking a button, or an enter event.

Controller: Brains of the application.
The controller connects the model and view. The controller converts inputs from the view to demands to retrieve/update data in the model.

The controller receives input from view, uses logic to translate the input to a demand for the model, the model grabs the data, the controller passes data from the model back to the view for the user to see in a nice display.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What are callbacks in the context of ROR?

A

Callbacks are methods that get called at certain moments of an object’s life cycle. They allow you to trigger logic before or after an alteration of an object’s state. With callbacks, it is possible to write code that will run whenever an Active Record object is created, saved, updated, deleted, validated, or loaded from the database.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is ORM?

A

Object Relational Mapping is a technique that connects the rich objects of an application to tables in a relational database management system. Using ORM, the properties and relationships of the objects in an application can be easily stored and retrieved from a database without writing SQL statements directly and with less overall database access code.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is Active Record in Rails?

A

Active Record is the M in MVC - the model - which is the layer of the system responsible for representing business data and logic. Active Record facilitates the creation and use of business objects whose data requires persistent storage to a database. It is an implementation of the Active Record pattern which itself is a description of an Object Relational Mapping system.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly