Add VotationType model

This commit is contained in:
decabeza
2022-08-30 12:09:13 +02:00
committed by Senén Rodero Rodríguez
parent d2cc110678
commit d1c1aa6691
7 changed files with 100 additions and 0 deletions

View File

@@ -0,0 +1,12 @@
module Questionable
extend ActiveSupport::Concern
included do
has_one :votation_type, as: :questionable, dependent: :destroy
delegate :max_votes, :multiple?, :vote_type, to: :votation_type, allow_nil: true
end
def unique?
votation_type.nil? || votation_type.unique?
end
end