Skip to content

Commit 761cac6

Browse files
committed
final column wrap
1 parent 500ce97 commit 761cac6

File tree

1 file changed

+23
-21
lines changed

1 file changed

+23
-21
lines changed

guides/source/active_record_validations.md

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,8 @@ irb> line_item_with_order.valid?
435435
=> false # absence validation fails
436436
```
437437

438-
NOTE: For `belongs_to` the association presence is validated by default. If you don’t want to have association presence validated, use `optional: true`.
438+
NOTE: For `belongs_to` the association presence is validated by default. If you
439+
don’t want to have association presence validated, use `optional: true`.
439440

440441
Rails will usually infer the inverse association automatically. In cases where
441442
you use a custom `:foreign_key` or a `:through` association, it's important to
@@ -480,8 +481,8 @@ end
480481
```
481482

482483
This check is performed only if `terms_of_service` is not `nil`. The default
483-
error message for this validation is _"must be accepted"_. You can also pass in a
484-
custom message via the `message` option.
484+
error message for this validation is _"must be accepted"_. You can also pass in
485+
a custom message via the `message` option.
485486

486487
```ruby
487488
class Person < ApplicationRecord
@@ -502,8 +503,8 @@ end
502503

503504
This validation is very specific to web applications and this 'acceptance' does
504505
not need to be recorded anywhere in your database. If you don't have a field for
505-
it, the validator will create a virtual attribute. If the field does exist in your
506-
database, the `accept` option must be set to or include `true` or else the
506+
it, the validator will create a virtual attribute. If the field does exist in
507+
your database, the `accept` option must be set to or include `true` or else the
507508
validation will not run.
508509

509510
### `confirmation`
@@ -573,8 +574,8 @@ class Promotion < ApplicationRecord
573574
end
574575
```
575576

576-
The default error message for this validator is _"failed comparison"_. You can also
577-
pass in a custom message via the `message` option.
577+
The default error message for this validator is _"failed comparison"_. You can
578+
also pass in a custom message via the `message` option.
578579

579580
These options are all supported:
580581

@@ -656,8 +657,8 @@ class Account < ApplicationRecord
656657
end
657658
```
658659

659-
Both validators allow the use of dynamic validation through methods that return an
660-
enumerable. Here’s an example using a proc for `inclusion`:
660+
Both validators allow the use of dynamic validation through methods that return
661+
an enumerable. Here’s an example using a proc for `inclusion`:
661662

662663
```ruby
663664
class Coffee < ApplicationRecord
@@ -727,8 +728,9 @@ together.
727728

728729
### `numericality`
729730

730-
This validator validates that your attributes have only numeric values. By default,
731-
it will match an optional sign followed by an integer or floating point number.
731+
This validator validates that your attributes have only numeric values. By
732+
default, it will match an optional sign followed by an integer or floating point
733+
number.
732734

733735
To specify that only integer numbers are allowed, set `:only_integer` to true.
734736
Then it will use the following regular expression to validate the attribute's
@@ -779,8 +781,8 @@ values:
779781

780782
### `presence`
781783

782-
This validator validates that the specified attributes are not empty. It uses the
783-
[`Object#blank?`][] method to check if the value is either `nil` or a blank
784+
This validator validates that the specified attributes are not empty. It uses
785+
the [`Object#blank?`][] method to check if the value is either `nil` or a blank
784786
string - that is, a string that is either empty or consists of whitespace.
785787

786788
```ruby
@@ -934,9 +936,9 @@ See [`validates_uniqueness_of`][] for more information.
934936

935937
### `validates_associated`
936938

937-
You should use this validator when your model has associations that always need to
938-
be validated. Every time you try to save your object, `valid?` will be called on
939-
each one of the associated objects.
939+
You should use this validator when your model has associations that always need
940+
to be validated. Every time you try to save your object, `valid?` will be called
941+
on each one of the associated objects.
940942

941943
```ruby
942944
class Library < ApplicationRecord
@@ -963,9 +965,9 @@ everything up until now can also be used on any object which includes
963965

964966
### `validates_each`
965967

966-
This validator validates attributes against a block. It doesn't have a predefined
967-
validation function. You should create one using a block, and every attribute
968-
passed to [`validates_each`][] will be tested against it.
968+
This validator validates attributes against a block. It doesn't have a
969+
predefined validation function. You should create one using a block, and every
970+
attribute passed to [`validates_each`][] will be tested against it.
969971

970972
In the following example, we will reject names and surnames that begin with
971973
lowercase.
@@ -1036,8 +1038,8 @@ end
10361038
We will cover [validation errors](#working-with-validation-errors) in greater
10371039
detail later.
10381040

1039-
The [`validates_with`][] validator takes a class, or a list of classes to use for
1040-
validation.
1041+
The [`validates_with`][] validator takes a class, or a list of classes to use
1042+
for validation.
10411043

10421044
```ruby
10431045
class Person < ApplicationRecord

0 commit comments

Comments
 (0)