Model Class - Singular: BookClub DB Table - Plural: book_clubs
- Foreign keys - Singularized_table_name_id: item_id, order_id
- Primary keys - id
- created_at
- updated_at
- lock_version - Optimistic Locking
- type - Single Table Inheritance
- (association_name)_type - Polymorphic Associations
- (table_name)_count - Cache number of objects: comments_count
user = User.create(name: "David", occupation: "Code Artist") user = User.new user.name = "David" user.save
users = User.all user = User.first user = User.find_by(name: 'David') users = User.where(name: 'David', occupation: 'Code Artist').order(created_at: :desc)
user = User.find_by(name: 'David')
rails g migration AddPartNumberToProducts part_number:string rails g migration AddPartNumberToProducts part_number:string:index rails g migration AddDetailsToProducts part_number:string price:decimal
rails g migration RemovePartNumberFromProducts part_number:string
rails g migration CreateProducts name:string part_number:string
rails g migration CreateJoinTableCustomerProduct customer product