Skip to content

Commit

Permalink
Merge pull request rails#54093 from hachi8833/fix_validation_guide2
Browse files Browse the repository at this point in the history
  • Loading branch information
vipulnsward authored Jan 2, 2025
2 parents 9a9b05a + d2bc1b9 commit be9aa73
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions guides/source/active_record_validations.md
Original file line number Diff line number Diff line change
Expand Up @@ -1156,7 +1156,7 @@ empty string for example.

```ruby
class Topic < ApplicationRecord
validates :title, length: { is: 5 }, allow_blank: true
validates :title, length: { is: 6 }, allow_blank: true
end
```

Expand All @@ -1166,7 +1166,7 @@ irb> Topic.create(title: "").valid?
irb> Topic.create(title: nil).valid?
=> true
irb> Topic.create(title: "short").valid?
=> false # 'short' is not of length 5, so validation fails even though it's not blank
=> false # 'short' is not of length 6, so validation fails even though it's not blank
```

### `:message`
Expand Down

0 comments on commit be9aa73

Please sign in to comment.