Skip to content

Instantly share code, notes, and snippets.

@akshaysmurthy
Created August 17, 2016 05:18
Show Gist options
  • Save akshaysmurthy/fc42c2de7a131e39096de69fe00a663b to your computer and use it in GitHub Desktop.
Save akshaysmurthy/fc42c2de7a131e39096de69fe00a663b to your computer and use it in GitHub Desktop.
Validates presence with if clause
validates :response_options, presence: { if: Proc.new { |item| item.type == 'single-select' }, message: 'single select item cannot be empty.' }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment