Sha256: dd9b42e78d624164dc56e34290bcc21f915f0c32869e5752236cbcdce8a03904
Contents?: true
Size: 691 Bytes
Versions: 3
Compression:
Stored size: 691 Bytes
Contents
module Tasuku module Concerns::Models::Taskables::Question extend ActiveSupport::Concern included do include ::Tasks::Taskables::Taskable include ::Tasks::Concerns::Illustratable has_many :options has_many :votes, through: :options validates_presence_of :text accepts_nested_attributes_for :options, allow_destroy: true def answers Taskables::Question::Answer.joins(:votes).where( Taskables::Question::Vote.table_name => { option_id: options.pluck(:id) } ).uniq end def single? !multiple? end def to_s text end responses are: :answers end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
tasuku-1.1.0 | lib/tasuku/concerns/models/taskables/question.rb |
tasuku-1.0.1 | lib/tasuku/concerns/models/taskables/question.rb |
tasuku-0.1.1 | lib/tasuku/concerns/models/taskables/question.rb |