Sha256: ef76a9c0556977f94c8e7af1bb042c4251af498ecb0c41fc243b1199d8d88cbc

Contents?: true

Size: 796 Bytes

Versions: 13

Compression:

Stored size: 796 Bytes

Contents

# frozen_string_literal: true

module Decidim
  # Defines a relation between a user and an assembly, and what kind of relation
  # does the user have.
  class AssemblyUserRole < ApplicationRecord
    include Traceable
    include Loggable
    include ParticipatorySpaceUser

    belongs_to :assembly, foreign_key: "decidim_assembly_id", class_name: "Decidim::Assembly", optional: true
    alias participatory_space assembly

    scope :for_space, ->(participatory_space) { where(assembly: participatory_space) }

    validates :role, inclusion: { in: ParticipatorySpaceUser::ROLES }, uniqueness: { scope: [:user, :assembly] }
    def target_space_association = :assembly

    def self.log_presenter_class_for(_log)
      Decidim::Assemblies::AdminLog::AssemblyUserRolePresenter
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
decidim-assemblies-0.29.1 app/models/decidim/assembly_user_role.rb
decidim-assemblies-0.28.4 app/models/decidim/assembly_user_role.rb
decidim-assemblies-0.29.0 app/models/decidim/assembly_user_role.rb
decidim-assemblies-0.28.3 app/models/decidim/assembly_user_role.rb
decidim-assemblies-0.29.0.rc4 app/models/decidim/assembly_user_role.rb
decidim-assemblies-0.29.0.rc3 app/models/decidim/assembly_user_role.rb
decidim-assemblies-0.29.0.rc2 app/models/decidim/assembly_user_role.rb
decidim-assemblies-0.29.0.rc1 app/models/decidim/assembly_user_role.rb
decidim-assemblies-0.28.2 app/models/decidim/assembly_user_role.rb
decidim-assemblies-0.28.1 app/models/decidim/assembly_user_role.rb
decidim-assemblies-0.28.0 app/models/decidim/assembly_user_role.rb
decidim-assemblies-0.28.0.rc5 app/models/decidim/assembly_user_role.rb
decidim-assemblies-0.28.0.rc4 app/models/decidim/assembly_user_role.rb