mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
fix syntax of AM::Validations::HelperMethods examples [ci skip]
This commit is contained in:
parent
68df230255
commit
70c4676d88
4 changed files with 6 additions and 6 deletions
|
@ -22,7 +22,7 @@ module ActiveModel
|
|||
# validates_exclusion_of :username, in: %w( admin superuser ), message: "You don't belong here"
|
||||
# validates_exclusion_of :age, in: 30..60, message: 'This site is only for under 30 and over 60'
|
||||
# validates_exclusion_of :format, in: %w( mov avi ), message: "extension %{value} is not allowed"
|
||||
# validates_exclusion_of :password, in: ->{ |p| [p.username, p.first_name] },
|
||||
# validates_exclusion_of :password, in: ->(person) { [person.username, person.first_name] },
|
||||
# message: 'should not be the same as your username or first name'
|
||||
# end
|
||||
#
|
||||
|
|
|
@ -73,7 +73,7 @@ module ActiveModel
|
|||
# class Person < ActiveRecord::Base
|
||||
# # Admin can have number as a first letter in their screen name
|
||||
# validates_format_of :screen_name,
|
||||
# with: ->{ |person| person.admin? ? /\A[a-z0-9][a-z0-9_\-]*\z/i : /\A[a-z][a-z0-9_\-]*\z/i }
|
||||
# with: ->(person) { person.admin? ? /\A[a-z0-9][a-z0-9_\-]*\z/i : /\A[a-z][a-z0-9_\-]*\z/i }
|
||||
# end
|
||||
#
|
||||
# Note: use <tt>\A</tt> and <tt>\Z</tt> to match the start and end of the
|
||||
|
|
|
@ -22,7 +22,7 @@ module ActiveModel
|
|||
# validates_inclusion_of :gender, in: %w( m f )
|
||||
# validates_inclusion_of :age, in: 0..99
|
||||
# validates_inclusion_of :format, in: %w( jpg gif png ), message: "extension %{value} is not included in the list"
|
||||
# validates_inclusion_of :states, in: ->{ |person| STATES[person.country] }
|
||||
# validates_inclusion_of :states, in: ->(person) { STATES[person.country] }
|
||||
# end
|
||||
#
|
||||
# Configuration options:
|
||||
|
|
|
@ -74,7 +74,7 @@ module ActiveModel
|
|||
# validates_length_of :zip_code, minimum: 5, too_short: 'please enter at least 5 characters'
|
||||
# validates_length_of :smurf_leader, is: 4, message: "papa is spelled with 4 characters... don't play me."
|
||||
# validates_length_of :essay, minimum: 100, too_short: 'Your essay must be at least 100 words.',
|
||||
# tokenizer: ->{ |str| str.scan(/\w+/) }
|
||||
# tokenizer: ->(str) { str.scan(/\w+/) }
|
||||
# end
|
||||
#
|
||||
# Configuration options:
|
||||
|
@ -109,8 +109,8 @@ module ActiveModel
|
|||
# method, proc or string should return or evaluate to a +true+ or
|
||||
# +false+ value.
|
||||
# * <tt>:tokenizer</tt> - Specifies how to split up the attribute string.
|
||||
# (e.g. <tt>tokenizer: ->{|str| str.scan(/\w+/)}</tt> to count words
|
||||
# as in above example). Defaults to <tt>->{ |value| value.split(//) }</tt>
|
||||
# (e.g. <tt>tokenizer: ->(str) { str.scan(/\w+/) }</tt> to count words
|
||||
# as in above example). Defaults to <tt>->(value) { value.split(//) }</tt>
|
||||
# which counts individual characters.
|
||||
# * <tt>:strict</tt> - Specifies whether validation should be strict.
|
||||
# See <tt>ActiveModel::Validation#validates!</tt> for more information.
|
||||
|
|
Loading…
Reference in a new issue