Sha256: 173bc4d6e74d19deda1723f17fb4afe6c60f8628ad9d6c067e8e845e19d8b7d9
Contents?: true
Size: 852 Bytes
Versions: 70
Compression:
Stored size: 852 Bytes
Contents
# frozen_string_literal: true module Decidim # Data store the committee members for the initiative class InitiativesCommitteeMember < ApplicationRecord belongs_to :initiative, foreign_key: "decidim_initiatives_id", class_name: "Decidim::Initiative", inverse_of: :committee_members belongs_to :user, foreign_key: "decidim_users_id", class_name: "Decidim::User" enum state: [:requested, :rejected, :accepted] validates :state, presence: true validates :user, uniqueness: { scope: :initiative } scope :approved, -> { where(state: :accepted) } scope :non_deleted, -> { includes(:user).where(decidim_users: { deleted_at: nil }) } scope :excluding_author, -> { joins(:initiative).where.not("decidim_users_id = decidim_author_id") } end end
Version data entries
70 entries across 70 versions & 1 rubygems