Merge pull request #18132 from rochefort/fix-typo-nodoc

Fix typo in nodoc [ci skip]
Correctly handle Float -> BigDecimal with unspecified precision

Fixes #18122
document the return of `db:test:prepare`. Closes #18136. [ci skip]

This is a doc follow-up to #17739.

/cc @zzak
Use serve_static_files in guides [skip ci]

Conflicts:
	guides/source/configuring.md
Correctly handle limit on int4 and int8 types in PG

PG doesn't register it's types using the `int(4)` format that others do.
As such, if we alias `int8` to the other integer types, the range
information is lost. This is fixed by simply registering it separately.

The other option (which I specifically chose to avoid) is to pass the
information of the original type that was being aliased as an argument.
I'd rather avoid that, since an alias should truly be treated the same.
If we need different behavior for a different type, we should explicitly
register it with that, and not have a conditional based on aliasing.

Fixes #18144

[Sean Griffin & ysbaddaden]
Don't calculate all in-place changes to determine if attribute_changed?

Calling `changed_attributes` will ultimately check if every mutable
attribute has changed in place. Since this gets called whenever an
attribute is assigned, it's extremely slow. Instead, we can avoid this
calculation until we actually need it.

Fixes #18029
Don't perform statement caching for `find` when called from a scope

If there is a method defined such as `find_and_do_stuff(id)`, which then
gets called on an association, we will perform statement caching and the
parent ID will not change on subsequent calls.

Fixes #18117
Improve the performance of reading belongs_to associations

`ActiveRecord::Base#[]` has overhead that was introduced in 4.2. The
`foo["id"]` working with PKs other than ID isn't really a case that we
want to support publicly, but deprecating was painful enough that we
avoid it. `_read_attribute` was introduced as the faster alternative for
use internally. By using that, we can save a lot of overhead. We also
save some overhead by reading the attribute one fewer times in
`stale_state`.

Fixes #18151
Merge pull request #18163 from y-yagi/fix_nodoc_typo

fix typo in nodoc [ci skip]
Merge pull request #18162 from romaimperator/master

Fixing numeric attrs when set to same negative value
Merge pull request #18167 from al2o3cr/checkin_connection_leak

Fix connection leak when a thread checks in additional connections.
Don't treat `nil` as changed in serialized types

We were ignoring the `default_value?` escape clause in the serialized
type, which caused the default value to always be treated as changed.

Fixes #18169
Merge pull request #18170 from tgxworld/add_docs_for_rails_application_secrets

[ci skip]
Don't raise on out-of-range datetimes passed by a user
Merge pull request #18171 from greysteil/backport-out-of-range-fix

Don't raise on out-of-range datetimes passed by a user
Fix bug in ActionMailer guide.

When setting a mailer's default from address, you have to pass a hash
with a `:from` key; you can't pass just an email address.
Merge pull request #18206 from kamipo/dump_default_nil_for_postgresql_uuid_primary_key

Dump the default `nil` for PostgreSQL UUID primary key.
Conflicts:
	activerecord/CHANGELOG.md
Correctly ignore `case_sensitive` for UUID uniqueness validation

I think we should deprecate this behavior and just error if you tell us
to do a case insensitive comparison for types which are not case
sensitive. Partially reverts 35592307

Fixes #18195

Conflicts:
	activerecord/test/cases/adapters/postgresql/uuid_test.rb
Merge branch 'brainopia-remember_frozen_state_in_transaction'
Add missing `:nodoc:` [ci skip]

We're accidentally documenting `PredicateBuilder` and `ArrayHandler`
since there's a constant which is missing `# :nodoc:`