lib/active_record_survey/node/question.rb
def update_question_type(klass)
			if self.next_questions.length > 0
				raise RuntimeError.new "No questions can follow when changing the question type" 
			end

			nm = self.survey.node_maps

			answers = self.answers.collect { |answer|
				nm.select { |i|
					i.node == answer
				}
			}.flatten.uniq.collect { |answer_node_map|
				node = answer_node_map.node
				answer_node_map.send((answer_node_map.new_record?)? :destroy : :mark_for_destruction)
				node
			}.collect { |answer|
				answer.type = klass.to_s
				answer = answer.becomes(klass)
				answer.save if !answer.new_record?

				answer
			}.uniq

			answers.each { |answer|
				answer.survey = self.survey

				self.build_answer(answer)
			}
		end
def update_question_type(klass)
			if self.next_questions.length > 0
				raise RuntimeError.new "No questions can follow when changing the question type" 
			end

			nm = self.survey.node_maps

			answers = self.answers.collect { |answer|
				nm.select { |i|
					i.node == answer
				}
			}.flatten.uniq.collect { |answer_node_map|
				node = answer_node_map.node
				answer_node_map.send((answer_node_map.new_record?)? :destroy : :mark_for_destruction)
				node
			}.collect { |answer|
				answer.type = klass.to_s
				answer = answer.becomes(klass)
				answer.save if !answer.new_record?

				answer
			}.uniq

			answers.each { |answer|
				answer.survey = self.survey

				self.build_answer(answer)
			}
		end
Updates the answers of this question to a different type