From 435b91ad4cd1b1ca3be4aba658ffc2251d9ef11e Mon Sep 17 00:00:00 2001 From: Jared Cosulich Date: Sun, 3 Mar 2019 17:25:16 -0500 Subject: [PATCH] fixing bug --- app/models/school_category.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/models/school_category.rb b/app/models/school_category.rb index 0d67babd..db8534b7 100644 --- a/app/models/school_category.rb +++ b/app/models/school_category.rb @@ -17,7 +17,9 @@ class SchoolCategory < ApplicationRecord scope :valid, -> { where("zscore is not null or valid_child_count is not null") } def admin? - category.child_categories.each { |cc| return false if cc.benchmark.blank? } + child_categories = category.child_categories + return false if child_categories.blank? + child_categories.each { |cc| return false if cc.benchmark.blank? } return true end