1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Fix Active Record validation error messages markup in guides

The other way it was not marking the text as italic, it was showing the
underlines as normal text.

Also fixes some code examples indentation and # => marks in Active Model
and Active Record guides.

[ci skip]
This commit is contained in:
Carlos Antonio da Silva 2012-12-04 19:50:27 -02:00
parent 7f395600ce
commit 129eac0243
4 changed files with 61 additions and 61 deletions

View file

@ -200,7 +200,7 @@ Halting Execution
As you start registering new callbacks for your models, they will be queued for execution. This queue will include all your model's validations, the registered callbacks, and the database operation to be executed.
The whole callback chain is wrapped in a transaction. If any <em>before</em> callback method returns exactly `false` or raises an exception, the execution chain gets halted and a ROLLBACK is issued; <em>after</em> callbacks can only accomplish that by raising an exception.
The whole callback chain is wrapped in a transaction. If any _before_ callback method returns exactly `false` or raises an exception, the execution chain gets halted and a ROLLBACK is issued; _after_ callbacks can only accomplish that by raising an exception.
WARNING. Raising an arbitrary exception may break code that expects `save` and its friends not to fail like that. The `ActiveRecord::Rollback` exception is thought precisely to tell Active Record a rollback is going on. That one is internally captured but not reraised.

View file

@ -264,7 +264,7 @@ class Person < ActiveRecord::Base
end
```
The default error message for this helper is "_must be accepted_".
The default error message for this helper is _"must be accepted"_.
It can receive an `:accept` option, which determines the value that will be
considered acceptance. It defaults to "1" and can be easily changed.
@ -293,7 +293,7 @@ This validation will work with all of the association types.
CAUTION: Don't use `validates_associated` on both ends of your associations.
They would call each other in an infinite loop.
The default error message for `validates_associated` is "_is invalid_". Note
The default error message for `validates_associated` is _"is invalid"_. Note
that each associated object will contain its own `errors` collection; errors do
not bubble up to the calling model.
@ -328,7 +328,7 @@ class Person < ActiveRecord::Base
end
```
The default error message for this helper is "_doesn't match confirmation_".
The default error message for this helper is _"doesn't match confirmation"_.
### `exclusion`
@ -348,7 +348,7 @@ alias called `:within` that you can use for the same purpose, if you'd like to.
This example uses the `:message` option to show how you can include the
attribute's value.
The default error message is "_is reserved_".
The default error message is _"is reserved"_.
### `format`
@ -362,7 +362,7 @@ class Product < ActiveRecord::Base
end
```
The default error message is "_is invalid_".
The default error message is _"is invalid"_.
### `inclusion`
@ -381,7 +381,7 @@ will be accepted. The `:in` option has an alias called `:within` that you can
use for the same purpose, if you'd like to. The previous example uses the
`:message` option to show how you can include the attribute's value.
The default error message for this helper is "_is not included in the list_".
The default error message for this helper is _"is not included in the list"_.
### `length`
@ -471,24 +471,24 @@ Besides `:only_integer`, this helper also accepts the following options to add
constraints to acceptable values:
* `:greater_than` - Specifies the value must be greater than the supplied
value. The default error message for this option is "_must be greater than
%{count}_".
value. The default error message for this option is _"must be greater than
%{count}"_.
* `:greater_than_or_equal_to` - Specifies the value must be greater than or
equal to the supplied value. The default error message for this option is
"_must be greater than or equal to %{count}_".
_"must be greater than or equal to %{count}"_.
* `:equal_to` - Specifies the value must be equal to the supplied value. The
default error message for this option is "_must be equal to %{count}_".
default error message for this option is _"must be equal to %{count}"_.
* `:less_than` - Specifies the value must be less than the supplied value. The
default error message for this option is "_must be less than %{count}_".
default error message for this option is _"must be less than %{count}"_.
* `:less_than_or_equal_to` - Specifies the value must be less than or equal the
supplied value. The default error message for this option is "_must be less
than or equal to %{count}_".
supplied value. The default error message for this option is _"must be less
than or equal to %{count}"_.
* `:odd` - Specifies the value must be an odd number if set to true. The
default error message for this option is "_must be odd_".
default error message for this option is _"must be odd"_.
* `:even` - Specifies the value must be an even number if set to true. The
default error message for this option is "_must be even_".
default error message for this option is _"must be even"_.
The default error message is "_is not a number_".
The default error message is _"is not a number"_.
### `presence`
@ -528,7 +528,7 @@ If you validate the presence of an object associated via a `has_one` or
Since `false.blank?` is true, if you want to validate the presence of a boolean
field you should use `validates :field_name, inclusion: { in: [true, false] }`.
The default error message is "_can't be empty_".
The default error message is _"can't be empty"_.
### `uniqueness`
@ -570,7 +570,7 @@ end
WARNING. Note that some databases are configured to perform case-insensitive
searches anyway.
The default error message is "_has already been taken_".
The default error message is _"has already been taken"_.
### `validates_with`