Add VotationType model
This commit is contained in:
committed by
Senén Rodero Rodríguez
parent
d2cc110678
commit
d1c1aa6691
12
app/models/concerns/questionable.rb
Normal file
12
app/models/concerns/questionable.rb
Normal 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
|
||||
Reference in New Issue
Block a user