Donald Walters

Software Engineer

Database and Active Models

Rails is used for the majority of database management and model creation. Additionally, tests and test fixtures created

Create a data model, migration, test, and test fixture

Index (Read, all records)

bin/rails generate model Tablename name:string

Index (Read, all records)

bin/rails generate model Tablename name:string
Active Record Model

To run Rails console, use the following:

bin/rails console

Display the column names of a table using .column_names

Tablename.column_names

Add a record:

variablename = Tablename.new(columnname: "Value", columnname: "Value", etc...)

Save the record with the save command:

varaiblename.save

To view the resulting record, call the variablename directly:

varaiblename
Record Query

Query All Records of a Table with command .all:

Tablename.all

Query All Records of a Table with command .all:

Tablename.all