Legislation proposals adaptation in some models and initializers

This commit is contained in:
María Checa
2017-09-19 10:10:10 +02:00
parent 08d1e96575
commit c1672bdbf4
5 changed files with 19 additions and 6 deletions

View File

@@ -97,6 +97,12 @@ class User < ActiveRecord::Base
voted.each_with_object({}) { |v, h| h[v.votable_id] = v.value }
end
def legislation_proposal_votes(proposals)
voted = votes.for_proposals(proposals)
voted.each_with_object({}) { |v, h| h[v.votable_id] = v.value }
end
def spending_proposal_votes(spending_proposals)
voted = votes.for_spending_proposals(spending_proposals)
voted.each_with_object({}) { |v, h| h[v.votable_id] = v.value }