• ¿Documento equivocado? Cámbialo gratis
  • Escrito por estudiantes que aprobaron
  • Inmediatamente disponible después del pago
  • Leer en línea o como PDF
Vender
¿Dónde estudias?
Tu idioma
Document preview thumbnail
Vista previa 3 fuera de 17 páginas
Examen

CSE 3901 FINAL – RAILS NEWEST ACTUAL 2025/2026 UPDATED EXAM WITH COMPLETE QUESTIONS AND ANSWERS.VERIFED/GRADED A+

Document preview thumbnail
Vista previa 3 fuera de 17 páginas

CSE 3901 FINAL – RAILS NEWEST ACTUAL 2025/2026 UPDATED EXAM WITH COMPLETE QUESTIONS AND ANSWERS.VERIFED/GRADED A+

Vista previa del contenido

1



CSE 3901 FINAL – RAILS NEWEST ACTUAL 2025/2026
UPDATED EXAM WITH COMPLETE QUESTIONS AND
ANSWERS.VERIFED/GRADED A+
MVC Pattern - (ANSWER)A pattern that separates a program into the data, the
observer and the controller

Model

- The data (i.e. state)

- Methods for accessing and modifying state

View

- Renders contents of model for user

- When model changes, view must be updated

Controller

- Translates user actions (i.e. interactions with view) into operations on the model

- Example user actions: button clicks, menu selections



MVC in basic web application - (ANSWER)Model

- Database (table with rows)

- Classes that wrap database operations (class with instances)

View

- HTML (+ CSS, JavaScript) files rendered by client's browser

- Skeleton files used by server to generate these HTML files

Controller

- Receives HTTP requests via web server

, 2


- Orchestrates activity (model and view)



Mapping table to objects - (ANSWER)General strategy for OO languages:

- Table in database - a class

- Table columns - attributes of the class

- Table rows - instances of class (objects)



Database tables - (ANSWER)Database is a collection of tables

Each table has a list of columns

Each column has a name and a type

A table has a list of rows



Models - (ANSWER)Programmatic way for application to interact with database

- Model = a Ruby class

- Extends ApplicationRecord

- Found in app/models

Each class corresponds to a table

- Note: Models are singular (tables are plural)

- Includes attributes corresponding to columns implicitly



Class methods for Models - (ANSWER)Create a new instance with .new

Create instance and add it to database with .create

, 3


Retrieve particular rows from table with .find, .find_by, .all, .first, .last

Save a model as a row in database with .new followed by .save

Read/write attributes like ordinary class (e.g. p.title =... then p.save)

Delete a row from the table with .destroy (no save needed)



Which database to use? - (ANSWER)SQLite is the easiest (no setup)

MySQL has better performance

PostgreSQL favored for Heroku deployment



Table constraints - (ANSWER)Database is responsible for assigning unique
identifier for each row (a primary key, can't change after creation)



PRIMARY KEY, FOREIGN KEY, NOT NULL, NULL, UNIQUE, CHECK



Linking tables - (ANSWER)Different tables can be related to each other

Keys are used to encode this relationship

- E.g. Students table include a column identifying a student's major (foreign key)

Association is an invariant between tables



Schema (table structure) - (ANSWER)Table name

Column names and types

Constraints

Información del documento

Subido en
12 de septiembre de 2025
Número de páginas
17
Escrito en
2025/2026
Tipo
Examen
Contiene
Preguntas y respuestas
$21.99

¿Documento equivocado? Cámbialo gratis Dentro de los 14 días posteriores a la compra y antes de descargarlo, puedes elegir otro documento. Puedes gastar el importe de nuevo.
Escrito por estudiantes que aprobaron
Inmediatamente disponible después del pago
Leer en línea o como PDF

Seller avatar
Los indicadores de reputación están sujetos a la cantidad de artículos vendidos por una tarifa y las reseñas que ha recibido por esos documentos. Hay tres niveles: Bronce, Plata y Oro. Cuanto mayor reputación, más podrás confiar en la calidad del trabajo del vendedor.
TheAlphanurse
4.2
(385)
Vendido
5795
Seguidores
178
Artículos
6639
Última venta
1 día hace



Por qué los estudiantes eligen Stuvia

Creado por compañeros estudiantes, verificado por reseñas

Calidad en la que puedes confiar: escrito por estudiantes que aprobaron y evaluado por otros que han usado estos resúmenes.

¿No estás satisfecho? Elige otro documento

¡No te preocupes! Puedes elegir directamente otro documento que se ajuste mejor a lo que buscas.

Paga como quieras, empieza a estudiar al instante

Sin suscripción, sin compromisos. Paga como estés acostumbrado con tarjeta de crédito y descarga tu documento PDF inmediatamente.

Student with book image

“Comprado, descargado y aprobado. Así de fácil puede ser.”

Alisha Student

Preguntas frecuentes