
* Previously, some models had "duplicated" `belongs_to` associations, which were now removed (and replaced by the `include Creation`).
16 lines
344 B
Ruby
16 lines
344 B
Ruby
# frozen_string_literal: true
|
|
|
|
module Creation
|
|
extend ActiveSupport::Concern
|
|
|
|
ALLOWED_USER_TYPES = [InternalUser, ExternalUser].map(&:to_s).freeze
|
|
|
|
included do
|
|
belongs_to :user, polymorphic: true
|
|
alias_method :author, :user
|
|
alias_method :creator, :user
|
|
|
|
validates :user_type, inclusion: {in: ALLOWED_USER_TYPES}
|
|
end
|
|
end
|