Skip to content

Instantly share code, notes, and snippets.

@flarnie
Created August 2, 2013 15:40
Show Gist options
  • Save flarnie/6140907 to your computer and use it in GitHub Desktop.
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.
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