class Order < ApplicationRecord validates :status, presence: true validates :total, numericality: { greater_than: 0 }, if: :paid? before_validation :normalize_status before_save :calculate_total after_create :send_confirmation after_commit :notify_warehouse private def normalize_status self.status = status&.strip&.downcase end def calculate_total # placeholder end def send_confirmation # placeholder end def notify_warehouse # placeholder end def paid? status == "paid" end end