diff --git a/app/models/spending_proposal.rb b/app/models/spending_proposal.rb index 9572f9695..3a13935c4 100644 --- a/app/models/spending_proposal.rb +++ b/app/models/spending_proposal.rb @@ -30,6 +30,7 @@ class SpendingProposal < ActiveRecord::Base scope :feasible, -> { where(feasible: true) } scope :unfeasible, -> { where(feasible: false) } scope :not_unfeasible, -> { where("feasible IS ? OR feasible = ?", nil, true) } + scope :with_supports, -> { where('cached_votes_up > 0') } scope :by_admin, -> (admin) { where(administrator_id: admin.presence) } scope :by_tag, -> (tag_name) { tagged_with(tag_name) } @@ -147,8 +148,4 @@ class SpendingProposal < ActiveRecord::Base valuation_finished.unfeasible end - def self.with_supports - SpendingProposal.where(id: Vote.for_spending_proposals(SpendingProposal.all).map(&:votable).map(&:id)) - end - end