From 23ad52a8db8f76a61283de69c6f56a0a0ce4a3ee Mon Sep 17 00:00:00 2001 From: Emi Matchu Date: Tue, 21 May 2024 17:24:55 -0700 Subject: [PATCH] Oops, don't crash calling `current_nc_price` on non-NC-Mall items If `nc_mall_record` is `nil`, return `nil`! (This is the nil method chaining operator!) --- app/models/item.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/item.rb b/app/models/item.rb index e5295be1..15f7dc18 100644 --- a/app/models/item.rb +++ b/app/models/item.rb @@ -176,7 +176,7 @@ class Item < ApplicationRecord end def current_nc_price - nc_mall_record.current_price + nc_mall_record&.current_price end def restricted_zones(options={})