* Add ".[key]" to the abstract namespaces [ci skip]
The section "Error Message Scopes" describes how the Rails look up the
namespaces for a validation error message with code snippets.
The first code snippet shows abstract namespaces like
`errors.attributes.[attribute_name]` while the second one demonstrates
the materialized one like `errors.attributes.name.blank`.
The first code snippet lacks the validation error "key." My team member
was confused and created a translation without "key", so I think it
would be helpful to add ".[key]" to the abstract namespaces.
* Move abstract key list after :blank examples
Co-authored-by: Rafael Mendonça França <rafael@rubyonrails.org>
This field returns the amount of rows returned by the query that emitted the notification.
This metric is useful in cases where one wants to detect queries with big result sets.
Motivation / Background
---
Strict Locals support was introduced in [#45727][] and announced as part
of the [7.1 Release][]. There are several mentions across the Guides,
but support is rarely mentioned in the API documentation.
Detail
----
Mention the template short identifier (the pathname, in most cases) as
part of the `ArgumentError` message.
This commit adds two test cases to ensure support for splatting
additional arguments, and for forbidding block and positional arguments.
It also makes mention of strict locals in more places, and links to the
guides.
[#45727]: https://github.com/rails/rails/pull/45727
[7.1 Release]: https://edgeguides.rubyonrails.org/7_1_release_notes.html#allow-templates-to-set-strict-locals
The code: Book.joins(:author, :reviews)
This code will return books that have an author and at least 1
review.
English text implies it returns the book and the author:
"return all books with their author .."
Changing the text to imply it returns books with an author.
When Rake parses an argument string with no tasks, it sets the top-level
task as "default". Prior to this commit, if no default task was defined
(for example, if an app was generated with `--skip-test` and didn't
define its own default task), `Rails::Command::RakeCommand` would raise
`UnrecognizedCommandError`, preventing Rake from displaying the task
list.
This commit changes `Rails::Command::RakeCommand` to let Rake handle the
"default" task.
Fixes#50700.
Support for the new `action_dispatch.show_exceptions` values was
introduced in [e28f147][]. Alongside the change to introduce new values
(like `:all`, `:rescuable`, `:none`), the default behavior was changed
for `Rails.env.test?`.
Prior to that commit, the `test` environment's default value was `false`
(introduced in [d898a4b][]) (which corresponds to the new `:none`
setting).
The new default behavior has some unintended negative side effects that
impact the feedback loop at the core of test-driven development.
When errors are rescued and transformed into HTML pages, the context of
the cause of failure is obscured by additional layers of information.
First, this commit adds more prominent entries to the Upgrading and
Configuring guides, as well as the 7.1 Release Notes to document the
details of the configuration and its new values.
Next, this commit adds more documentation around the change in default
behavior. To start, it mentions the new value in the sections for the
affected test types: Controller, Integration, and System.
[e28f147]: e28f147329
[d898a4b]: d898a4ba42
We recently had [two][1] [PRs][2] to update these types of links, so
this commit does all of the rest (remaining links to master branches
were checked and still exist).
[1]: e76c52a939dd7312fb9fd22b08e13496dc5c961e
[2]: a2ed3437e3be1e4dee4d1dac3c51a3b8742044ff
Provide examples for rendering objects that respond to `render_in`. Also
highlight that the object can also define a `#format` method to control
how the rendered String should be treated.
Add test coverage for both Action View's and Action Pack's support for
`render` with `:renderable` options.
It is the role of the underlying serializer to accept or reject the data
to decrypt depending on its type. This behavior mirrors what is done at
encryption, where the serializer asserts that the input is an
ActiveRecord::Encryption::Message.
This change allows for a wider variety of custom serializers, but does
not change the behavior when using the default MessageSerializer class.
Indeed, the default message serializer will raise a TypeError when
invoking JSON.parse on any non-String input. This error will subsequently
be translated into an ActiveRecord::Encryption::Errors::Encoding error
by the encryptor, which does not change the current behavior at the
encryptor level.
A new test asserts that the default MessageSerializer is able to reject
unexpected data types on its own at decryption time, just as it does at
encryption time (test already present). The test also asserts that an
exception is translated into an ActiveRecord::Encryption::Error::Encoding
error at the encryptor level.