lib/tasuku/concerns/models/taskables/question.rb in tasuku-0.1.0 vs lib/tasuku/concerns/models/taskables/question.rb in tasuku-0.1.1
- old
+ new
@@ -7,9 +7,11 @@
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) }