# หาบั๊กให้เจอ: Ruby on Rails > โค้ดหนึ่งชิ้น หาบั๊กให้เจอ หรือพิสูจน์ว่าไม่มีบั๊ก ชาเลนจ์ประจำวัน: 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 ``` ## คำตัดสินของคุณ - ช่องโหว่ความปลอดภัย - บั๊กเชิงตรรกะ - สไตล์โค้ด - ไม่มีปัญหา วันละหนึ่งครั้ง คำตอบจะแสดงทันทีหลังจากนั้น --- Source: SharpSkill (https://sharpskill.dev), tech interview preparation for your real stack. HTML version of this page: https://sharpskill.dev/th/daily/ruby-on-rails