Skip to content

Instantly share code, notes, and snippets.

@slagyr
Forked from pitluga/gist:1164228
Created August 23, 2011 03:22
Show Gist options
  • Save slagyr/1164267 to your computer and use it in GitHub Desktop.
Save slagyr/1164267 to your computer and use it in GitHub Desktop.
simple validation
(defn validate [params-hash]
(let [keys [:model :pk]
missing-keys (filter #(nil? (params-hash %)) keys)]
(apply hash-map (interleave missing-keys (repeat "is required")))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment