avoids postgres exception regarding subquery limits
We have apparently reached a postgres limit for the number of attributes we query. Using ids instead of the proposal objects seems to fix it Using `Array` and `map` instead of `pluck`, because the proposals attribute can be a single object
This commit is contained in:
@@ -91,7 +91,7 @@ class User < ActiveRecord::Base
|
||||
end
|
||||
|
||||
def proposal_votes(proposals)
|
||||
voted = votes.for_proposals(proposals)
|
||||
voted = votes.for_proposals(Array(proposals).map(&:id))
|
||||
voted.each_with_object({}) { |v, h| h[v.votable_id] = v.value }
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user