Skip to content

Instantly share code, notes, and snippets.

@kwando
Created May 27, 2016 12:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kwando/ee9897b9c49cbfefe792e17d91ac4817 to your computer and use it in GitHub Desktop.
Save kwando/ee9897b9c49cbfefe792e17d91ac4817 to your computer and use it in GitHub Desktop.
schema example ruby
# Each user has his own set of categories and I need to validate that the category_id provided belongs to the author of the post.
new_post_schema = Dry::Validation.Schema{
key(:author_id).required(:int?)
key(:category_id).required(:int?)
key(:title).required(:str?)
key(:body).required(:str?)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment