Sha256: ee17a23abec33a92c7b2ae2500e0e61d4c4a73f7e76c275638fa0b7366fad7a8
Contents?: true
Size: 762 Bytes
Versions: 53
Compression:
Stored size: 762 Bytes
Contents
# frozen_string_literal: true module Decidim # This concern contains the logic related to followable resources. module Followable extend ActiveSupport::Concern included do has_many :follows, as: :followable, foreign_key: "decidim_followable_id", foreign_type: "decidim_followable_type", class_name: "Decidim::Follow", counter_cache: :follows_count has_many :followers, through: :follows, source: :user end def followers if respond_to?(:participatory_space) && participatory_space.present? && participatory_space.respond_to?(:followers) super.or(participatory_space.followers).distinct else super end end end end
Version data entries
53 entries across 53 versions & 1 rubygems