Nonprofit page now only shows non-child campaigns

This commit is contained in:
Eric Schultz 2019-02-06 11:24:37 -06:00 committed by Eric Schultz
parent 6e77a98bff
commit 3d1fac1655
2 changed files with 2 additions and 1 deletions

View file

@ -19,7 +19,7 @@
@profiles = @nonprofit.profiles.order('total_raised DESC').limit(5).includes(:user).uniq
events = @nonprofit.events.not_deleted.order('start_datetime desc')
campaigns = @nonprofit.campaigns.not_deleted.order('created_at desc')
campaigns = @nonprofit.campaigns.not_deleted.not_a_child.order('created_at desc')
@events = events.upcoming
@any_past_events = events.past.any?

View file

@ -76,6 +76,7 @@ class Campaign < ActiveRecord::Base
scope :unpublished, -> {where(:published => [nil, false])}
scope :not_deleted, -> {where(deleted: [nil, false])}
scope :deleted, -> {where(deleted: true)}
scope :not_a_child, -> {where(parent_campaign_id: nil)}
before_validation do
if self.goal_amount_dollars.present?