Challenge 1: A User Model — Solution Command: $ rails generate migration CreateUsers email:string password_digest:string Migration file: # db/migrate/20260104000000_create_users.rb class CreateUsers < ActiveRecord::Migration[7.1] def change create_table :users do |t| t.string :email t.string :password_digest t.timestamps end end end Model: # app/models/user.rb class User < ApplicationRecord has_secure_password validates :email, presence: true, uniqueness: true end =begin Notes: - password_digest is a plain string column -- has_secure_password is what gives it special meaning (bcrypt hashing, the virtual password/ password_confirmation attributes), not the column name or type alone. Without has_secure_password on the model, password_digest would just be an ordinary, unused string column. - validates :email, uniqueness: true prevents two users from registering with the same email address -- has_secure_password itself only handles password hashing/authentication, it has no opinion about email uniqueness at all. - t.timestamps adds created_at/updated_at automatically, following the same convention as every migration in Course 1. =end