Challenge 1: Validate a Model — Solution class Product < ApplicationRecord validates :name, presence: true, length: { maximum: 50 } validates :price, numericality: { greater_than: 0 } validates :sku, uniqueness: true end product = Product.new(name: "", price: -5) product.valid? puts product.errors.full_messages =begin Expected output: Name can't be blank Price must be greater than 0 Notes: - name: "" fails the presence: true validator, producing "Name can't be blank". - price: -5 fails numericality: { greater_than: 0 }, producing "Price must be greater than 0". - sku isn't set at all in this example, so its uniqueness validator isn't shown failing here — uniqueness only becomes relevant once a value exists to compare against other rows. - .valid? runs every validator and returns false, populating errors as a side effect; .save would behave the same way, refusing to write to the database and returning false instead of raising an exception. =end