Skip to content

Instantly share code, notes, and snippets.

@Carmer
Last active September 18, 2018 22:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 19 You must be signed in to fork a gist
  • Save Carmer/bdaa5be2509cabfffe8693c6d51d5096 to your computer and use it in GitHub Desktop.
Save Carmer/bdaa5be2509cabfffe8693c6d51d5096 to your computer and use it in GitHub Desktop.

Models, Databases, Relationships in Rails

What is the difference between a primary key and a foreign key? Where would we find a primary key? What would it be called by default? Where would we find a foreign key? What is the naming convention for a foreign key?

Write down one example of:

  • a one-to-one relationship.
  • a one-to-many relationship.
  • a many-to-many relationship.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment