From 6a9fcbdd0c65b35deba23faf2e63cfa6d63a04e8 Mon Sep 17 00:00:00 2001 From: georgethoppil Date: Wed, 11 May 2022 13:45:13 -0400 Subject: [PATCH] Adding a scope on subscription_line_item.rb to select records where price estimate is nil --- app/models/subscription_line_item.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/models/subscription_line_item.rb b/app/models/subscription_line_item.rb index 31a9450ea3..1e30f567ad 100644 --- a/app/models/subscription_line_item.rb +++ b/app/models/subscription_line_item.rb @@ -9,6 +9,7 @@ class SubscriptionLineItem < ApplicationRecord validates :quantity, presence: true, numericality: { only_integer: true } default_scope { order('id ASC') } + scope :nil_price_estimate, -> { where(price_estimate: nil) } def total_estimate (price_estimate || 0) * (quantity || 0)