Sha256: 77945a474dcd9d593e6d8b19af5eb4cb13ccf2de036d26728dd89cb36e55aadf
Contents?: true
Size: 949 Bytes
Versions: 5
Compression:
Stored size: 949 Bytes
Contents
# frozen_string_literal: true module Decidim module ReportingProposals module MapRelatedProposalsForFormOverride extend ActiveSupport::Concern included do alias_method :map_model_original, :map_model def map_model(model) map_model_original(model) self.proposal_ids += model.linked_resources(:reporting_proposals, "related_proposals").pluck(:id) end def proposals @proposals ||= begin proposals_query = Decidim.find_resource_manifest(:proposals).try(:resource_scope, current_component) reporting_proposals_query = Decidim.find_resource_manifest(:reporting_proposals).try(:resource_scope, current_component) (reporting_proposals_query ? proposals_query.or(reporting_proposals_query) : proposals_query) &.where(id: proposal_ids) &.order(title: :asc) end end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems