Sha256: 9fda45fdf4438a1c83b82fe93afa2ecac1338f44117a7515fef3e311e90b9b18

Contents?: true

Size: 620 Bytes

Versions: 8

Compression:

Stored size: 620 Bytes

Contents

# frozen_string_literal: true
module Decidim
  module Admin
    # Defines a relation between a user and a participatory process, and what
    # kind of relation does the user has.
    class ParticipatoryProcessUserRole < ApplicationRecord
      belongs_to :user, foreign_key: "decidim_user_id", class_name: Decidim::User
      belongs_to :participatory_process, foreign_key: "decidim_participatory_process_id", class_name: Decidim::ParticipatoryProcess

      ROLES = %w(admin collaborator).freeze
      validates :role, inclusion: { in: ROLES }, uniqueness: { scope: [:user, :participatory_process] }
    end
  end
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
decidim-admin-0.1.0 app/models/decidim/admin/participatory_process_user_role.rb
decidim-0.1.0 decidim-admin/app/models/decidim/admin/participatory_process_user_role.rb
decidim-admin-0.0.8.1 app/models/decidim/admin/participatory_process_user_role.rb
decidim-0.0.8.1 decidim-admin/app/models/decidim/admin/participatory_process_user_role.rb
decidim-admin-0.0.7 app/models/decidim/admin/participatory_process_user_role.rb
decidim-0.0.7 decidim-admin/app/models/decidim/admin/participatory_process_user_role.rb
decidim-admin-0.0.6 app/models/decidim/admin/participatory_process_user_role.rb
decidim-0.0.6 decidim-admin/app/models/decidim/admin/participatory_process_user_role.rb