Created
February 14, 2015 03:11
-
-
Save pyrabbit/175497b561d2070f4ee7 to your computer and use it in GitHub Desktop.
Validating that there are no possible answer duplicates
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| possible_answer_values = [] | |
| record.possible_answers.each do |p| | |
| possible_answer_values.push(p.value) | |
| end | |
| if record.possible_answers.length != possible_answer_values.uniq.length | |
| record.errors[:possible_answers] << "Question contains matching possible answers." | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment