diff --git a/config/initializers/acts_as_taggable_on.rb b/config/initializers/acts_as_taggable_on.rb index df1453908..940f411b2 100644 --- a/config/initializers/acts_as_taggable_on.rb +++ b/config/initializers/acts_as_taggable_on.rb @@ -37,7 +37,7 @@ module ActsAsTaggableOn scope :public_for_api, -> do where("(tags.kind IS NULL or tags.kind = ?) and tags.id in (?)", "category", - Tagging.public_for_api.pluck("DISTINCT taggings.tag_id")) + Tagging.public_for_api.distinct.pluck("taggings.tag_id")) end include PgSearch diff --git a/lib/user_segments.rb b/lib/user_segments.rb index ae6d345be..7927b8bfd 100644 --- a/lib/user_segments.rb +++ b/lib/user_segments.rb @@ -46,10 +46,8 @@ class UserSegments def self.not_supported_on_current_budget author_ids( User.where( - "id NOT IN (SELECT DISTINCT(voter_id) FROM votes"\ - " WHERE votable_type = ? AND votes.votable_id IN (?))", - "Budget::Investment", - current_budget_investments.pluck(:id) + "id NOT IN (?)", + Vote.select(:voter_id).where(votable: current_budget_investments).distinct ) ) end