Class: Qwester::Question
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Qwester::Question
- Defined in:
- app/models/qwester/question.rb
Instance Method Summary collapse
Instance Method Details
#build_standard_answers ⇒ Object
24 25 26 27 28 29 30 31 32 |
# File 'app/models/qwester/question.rb', line 24 def build_standard_answers created_answers = Array.new Answer.standard_values.each_with_index do |value, index| answer = answers.find_or_initialize_by_value(value) answer.position = index + 1 created_answers << answer end return created_answers end |
#create_standard_answers ⇒ Object
34 35 36 |
# File 'app/models/qwester/question.rb', line 34 def create_standard_answers build_standard_answers.each(&:save) end |