
During documentation of the pair programming feature, we noticed that the Contributor should be an abstract class, which is parent for the User and the ProgrammingGroup. With this commit, we perform these changes.
18 lines
477 B
Ruby
18 lines
477 B
Ruby
# frozen_string_literal: true
|
|
|
|
module ContributorCreation
|
|
extend ActiveSupport::Concern
|
|
|
|
ALLOWED_CONTRIBUTOR_TYPES = [InternalUser, ExternalUser, ProgrammingGroup].map(&:to_s).freeze
|
|
|
|
included do
|
|
belongs_to :contributor, polymorphic: true
|
|
alias_method :user, :contributor
|
|
alias_method :user=, :contributor=
|
|
alias_method :author, :user
|
|
alias_method :creator, :user
|
|
|
|
validates :contributor_type, inclusion: {in: ALLOWED_CONTRIBUTOR_TYPES}
|
|
end
|
|
end
|