Class: Rapidfire::Questions::Select

Inherits:
Rapidfire::Question show all
Defined in:
app/models/rapidfire/questions/select.rb

Direct Known Subclasses

Radio

Instance Method Summary collapse

Methods inherited from Rapidfire::Question

inherited, #rules

Instance Method Details

#optionsObject



6
7
8
# File 'app/models/rapidfire/questions/select.rb', line 6

def options
  answer_options.split(/\r?\n/)
end

#validate_answer(answer) ⇒ Object



10
11
12
13
14
15
16
# File 'app/models/rapidfire/questions/select.rb', line 10

def validate_answer(answer)
  super(answer)

  if rules[:presence] == "1" || answer.answer_text.present?
    answer.validates_inclusion_of :answer_text, :in => options
  end
end