Sha256: 23c3378ddc29e7302845580ae816bb0e4b32fe04933f0c10766161183924afa3
Contents?: true
Size: 779 Bytes
Versions: 7
Compression:
Stored size: 779 Bytes
Contents
# frozen_string_literal: true module Decidim module ActionDelegator # This query object replaces the ActiveRecord association we would have between the Vote and # Delegation models. Unfortunately we can't use custom foreign keys on both ends of the # association so this aims to replace `delegation.votes`. class DelegationVotes < Rectify::Query def query Delegation.joins( delegations.join(votes).on(vote_author_eq_granter).join_sources ) end private def votes Decidim::Consultations::Vote.arel_table end def delegations Delegation.arel_table end def vote_author_eq_granter votes[:decidim_author_id].eq(delegations[:granter_id]) end end end end
Version data entries
7 entries across 7 versions & 1 rubygems