The following code is executed before the model is saved. It checks a `has_many` association for change before looping through and setting a value on each. It checks through each answer option whether the `correct_answer` is changed on any of the answers. If so, it looks for which was changed and was `true`.

```
if self.answer_options.select{|a| a.correct_answer_changed?}.any?
  self.answer_options.each do |answer_option|
    if answer_option.correct_answer_changed? && !answer_option.correct_answer_was
      answer_option.correct_answer = true
    else
      answer_option.correct_answer = false
    end
  end
end

```

How could I simplify or improve this method?