Skip to content

Commit

Permalink
Update README for no longer needing 'validates' and switch to using k…
Browse files Browse the repository at this point in the history
…eywords for attribute names.
  • Loading branch information
duelinmarkers committed Jan 17, 2009
1 parent 466dfd2 commit b0ee4a8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.textile
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Do this.

(clj-record.core/init-model
(:validation
(validates name "Longer please." #(> (count %) 3)))) ; The leading "validates " will go away soon.
(:name "Longer please." #(> (count %) 3))))
</code></pre>

Then you get validation errors like this.
Expand Down
10 changes: 5 additions & 5 deletions clj_record/test/model/manufacturer.clj
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
(:associations
(has-many products))
(:validation
(name "empty!" #(not (empty? %)))
(name "starts with whitespace!" #(not (re-find #"^\s" %)))
(name "ends with whitespace!" #(not (re-find #"\s$" %)))
(founded "must be numeric" #(or (nil? %) (not (re-find #"\D" %))))
(grade my-grade-validation-message my-grade-validation-fn)))
(:name "empty!" #(not (empty? %)))
(:name "starts with whitespace!" #(not (re-find #"^\s" %)))
(:name "ends with whitespace!" #(not (re-find #"\s$" %)))
(:founded "must be numeric" #(or (nil? %) (not (re-find #"\D" %))))
(:grade my-grade-validation-message my-grade-validation-fn)))

0 comments on commit b0ee4a8

Please sign in to comment.