Questions: fixes, redesign form, fix edit error
This commit is contained in:
parent
38bc2e3c3a
commit
e25425bd77
20 changed files with 300 additions and 117 deletions
|
|
@ -8,12 +8,5 @@ class Question < ActiveRecord::Base
|
|||
has_many :answers, through: :qanswers, dependent: :delete_all
|
||||
|
||||
validates :title, :question_type_id, presence: true
|
||||
validate :existing_answers
|
||||
accepts_nested_attributes_for :answers, allow_destroy: true
|
||||
|
||||
private
|
||||
|
||||
def existing_answers
|
||||
errors.add(:base, 'Must have answers') if self.answers.blank?
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue