From be318260a3983f6eabd4f81d42ae4116d5aa7a62 Mon Sep 17 00:00:00 2001 From: Robin Tweedie Date: Wed, 29 Oct 2014 13:10:01 +0000 Subject: better example for tokenizer lambda [ci skip] Splitting on whitespace makes more sense in the context of counting words in an essay. --- guides/source/active_record_validations.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'guides/source') 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" } -- cgit v1.2.3