Sha256: 703ba7e080309ed262af461b9caf6a8384b4f97ff2dcd3f121e2ce3a2e59c1c2
Contents?: true
Size: 655 Bytes
Versions: 1
Compression:
Stored size: 655 Bytes
Contents
module Tasks 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 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
tasuku-0.0.1 | lib/tasks/concerns/models/taskables/question.rb |