- a primary key is the id of the current table, a foreign key is the id of a different table
- in the id field of the table
- id
- in the
other_table_id
field
- name_of_table_id
- a
one-to-one relationship
-> secretaries to bosses - a
one-to-many relationship
-> person to shirts - a
many-to-many relationship
-> students to classes
- test database - the database used to run tests on. usually empty or populated with minimal data
- dev database - the one that's used when you're working on changing features and working on the app
- production database - the one that get's used in the current public/publishable version of the app
- rails new [project name] --database=postgresql
- rails creates all the necessary migration and model files for the model that you specify
rails g model
will create all the things you need, model + migration + other filesrails g migration
will create just the migration file
Imagine that the items table has a category called quantity. What command would you type if you wanted to get rid of the quantity attribute?
- rake db:rolback