# Tìm lỗi: Ruby on Rails > Một đoạn mã. Tìm ra lỗi, hoặc chứng minh là không có lỗi nào. Thử thách hàng ngày: 2026-08-19 (UTC) · Mid-Level ```ruby class CartCalculator def total_with_discount(items, discount_rate) subtotal = items.sum(&:price) discount = subtotal * discount_rate subtotal - discount end end ``` ## Phán quyết của bạn - Lỗ hổng bảo mật - Lỗi logic - Phong cách mã - Không có vấn đề Một lần thử mỗi ngày. Đáp án hiện ra ngay sau đó. --- Source: SharpSkill (https://sharpskill.dev), tech interview preparation for your real stack. HTML version of this page: https://sharpskill.dev/vi/thu-thach-hang-ngay/ruby-on-rails