Created
August 2, 2013 15:40
-
-
Save flarnie/6140907 to your computer and use it in GitHub Desktop.
This version of the validator mistakenly prevents a user from editing their 'response' after it is saved.
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
def validate_not_yet_responded | |
responders = question.responses.map{ |r| r.chooser_id } | |
if responders.include?(self.chooser_id) | |
errors.add(:chooser_id, "you can only respond one time") | |
end | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment