Skip to content

Commit 29ca7a1

Browse files
committed
Remove the invalid usage document about errors. [ci skip]
1 parent 90e2739 commit 29ca7a1

File tree

1 file changed

+0
-18
lines changed

1 file changed

+0
-18
lines changed

guides/source/active_record_validations.md

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1133,24 +1133,6 @@ person.errors.full_messages
11331133
# => ["Name cannot contain the characters !@#%*()_-+="]
11341134
```
11351135

1136-
An equivalent to `errors#add` is to use `<<` to append a message to the `errors.messages` array for an attribute:
1137-
1138-
```ruby
1139-
class Person < ApplicationRecord
1140-
def a_method_used_for_validation_purposes
1141-
errors.messages[:name] << "cannot contain the characters !@#%*()_-+="
1142-
end
1143-
end
1144-
1145-
person = Person.create(name: "!@#")
1146-
1147-
person.errors[:name]
1148-
# => ["cannot contain the characters !@#%*()_-+="]
1149-
1150-
person.errors.to_a
1151-
# => ["Name cannot contain the characters !@#%*()_-+="]
1152-
```
1153-
11541136
### `errors.details`
11551137

11561138
You can specify a validator type to the returned error details hash using the

0 commit comments

Comments
 (0)