We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 6124c9d commit fdde96aCopy full SHA for fdde96a
1 file changed
app/models/item.rb
@@ -6,6 +6,7 @@ class Item < ApplicationRecord
6
validate :category_must_be_active
7
validate :fixed_parameters_values_must_be_numeric
8
validate :pricing_options_values_must_be_numeric
9
+ validates :calculation_formula, presence: true, if: :requires_calculation_formula?
10
11
def self.ransackable_attributes(_auth_object = nil)
12
%w[category_id created_at id is_disabled name updated_at]
@@ -63,4 +64,8 @@ def numeric?(val)
63
64
false
65
end
66
67
+
68
+ def requires_calculation_formula?
69
+ is_fixed || is_open || is_selectable_options
70
+ end
71
0 commit comments