diff options
author | Robin Tweedie <robin@songkick.com> | 2014-10-29 13:10:01 +0000 |
---|---|---|
committer | Robin Tweedie <robin@songkick.com> | 2014-10-29 13:13:39 +0000 |
commit | be318260a3983f6eabd4f81d42ae4116d5aa7a62 (patch) | |
tree | b58c43d5f4a58304a402c83a664715ff95df21d7 /guides/source | |
parent | 76bec5939c4855f7522ada2f38409357778810ce (diff) | |
download | rails-be318260a3983f6eabd4f81d42ae4116d5aa7a62.tar.gz rails-be318260a3983f6eabd4f81d42ae4116d5aa7a62.tar.bz2 rails-be318260a3983f6eabd4f81d42ae4116d5aa7a62.zip |
better example for tokenizer lambda [ci skip]
Splitting on whitespace makes more sense in the context of counting words in an
essay.
Diffstat (limited to 'guides/source')
-rw-r--r-- | guides/source/active_record_validations.md | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/guides/source/active_record_validations.md b/guides/source/active_record_validations.md index 1c1b863fe9..6f45ca698d 100644 --- a/guides/source/active_record_validations.md +++ b/guides/source/active_record_validations.md @@ -427,7 +427,7 @@ class Essay < ActiveRecord::Base validates :content, length: { minimum: 300, maximum: 400, - tokenizer: lambda { |str| str.scan(/\w+/) }, + tokenizer: lambda { |str| str.split(/\s+/) }, too_short: "must have at least %{count} words", too_long: "must have at most %{count} words" } |