From ea049c43b53cfae220ca9ca443ac6b729e7712f6 Mon Sep 17 00:00:00 2001 From: Eric Date: Thu, 18 Jun 2020 15:46:47 -0500 Subject: [PATCH] Add Campaign.get_campaign_and_children --- app/models/campaign.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/models/campaign.rb b/app/models/campaign.rb index 02621d9d..54e644e5 100644 --- a/app/models/campaign.rb +++ b/app/models/campaign.rb @@ -190,4 +190,9 @@ class Campaign < ApplicationRecord def parent_campaign? !child_campaign? end + + def self.get_campaign_and_children(campaign) + where('campaigns.id = ? OR campaigns.parent_campaign_id = ? ',campaign, campaign) + end + end