-
Notifications
You must be signed in to change notification settings - Fork 7
with
Myles Megyesi edited this page Oct 6, 2012
·
3 revisions
(defvalidator location-validator
[:gps :with {:message "bad gps!" :validator (fn [attrs] (not (or (nil? (:latitude attrs)) (nil? (:longitude attrs)))))}])
(location-validator {:latitude "" :longitude nil})
; {:gps ["bad gps!"]}
(location-validator {:latitude "90" :longitude "20"})
; {}
-
:validator
The validator to run against the record. This function should accept a map and return a boolean. Defaultnil
.
"is invalid"