Commit Graph

80920 Commits

Author SHA1 Message Date
Sean Doyle
3b34cb9e39 Resolve bug in nested FormBuilder#field_id
As a follow-up to [#40127][], this commit adds a bug fix for nested form
builders (through either `fields_for` or `fields`) incorrectly
constructing a field's `[id]` attribute. To do so, treat the
`@object_name` with higher precedence than the `@object`, since that
will be provided as instance state during construction.

[#40127]: https://github.com/rails/rails/pull/40127
2021-07-13 18:16:36 -04:00
Rafael França
ac87404bf8
Merge pull request #42723 from RRethy/gcs-iam-url-signing
Use IAM for URL signing with GCS when no credentials are provided
2021-07-13 16:58:20 -04:00
Adam P. Regasz-Rethy
dfd19e1a76 Add error handling for metadata server 2021-07-13 16:09:11 -04:00
Adam P. Regasz-Rethy
ae90855375 Optionally use IAM for URL signing instead of :credentials 2021-07-13 15:44:08 -04:00
John Hawthorn
a8a54a1821
Merge pull request #42764 from jhawthorn/logger_thread_safe_fiber_local
Avoid using class var in LoggerThreadSafeLevel
2021-07-13 10:54:15 -07:00
Jean Boussier
b01054dbab
Merge pull request #42776 from Shopify/refactor-type-map
Refactor ActiveRecord::Type::TypeMap
2021-07-13 17:58:51 +02:00
Jean Boussier
1bfa963c6b
Merge pull request #42775 from p8/railties/fix-spelling-of-whether
Fix spelling of "whether" to fix the CI
2021-07-13 17:41:57 +02:00
Jean Boussier
cf7db80fe1 Refactor ActiveRecord::Type::TypeMap
A good part of the complexity was to support the HashLookupTypeMap
subclass that's only used by the Postgres adapter.

In the end they have a similar-ish interface but this inheritance
doesn't help much.

Worse, adapters using `TypeMap` doesn't need extra arguments. By
skipping this unused feature, we can drastically reduce the memory
footprint, as this feature imposed a 320B per entry overhead.
2021-07-13 17:37:08 +02:00
Petrik
6ec0a974ee Fix spelling of whether to fix the CI 2021-07-13 17:27:29 +02:00
Jean Boussier
7bcfe447eb Add an entry for active_record.partial_inserts in new_framework_defaults 2021-07-13 16:06:30 +02:00
Jean Boussier
88ec15b850
Merge pull request #42773 from Shopify/static-typemaps
Define adapter type maps statically when possible
2021-07-13 15:56:55 +02:00
Ryuta Kamizono
75d6ea3c99
Merge pull request #42772 from alkesh26/typo-fix-activerecord-changelog
[ci-skip] Typo fix in activerecord changelog
2021-07-13 21:33:38 +09:00
Jean Boussier
d79fb96360 Define adapter type maps statically when possible
Each type map can use a non trivial amount of memory (over 10KiB
in our app).

Currently each connection build its own type map from scratch, but
except for postgresql which has extension types, all connections
end up with the same maps.

So the more connections you have the more memory it wastes.

By defining the type map statically for MySQL and SQLite3 connections
we save some memory, share caches, and allow that memory to be handled
by Copy on Write for forking setups.
2021-07-13 14:21:03 +02:00
alkeshghorpade
a6ce872ec6 [ci-skip] typo fix in activerecord changelog 2021-07-13 17:01:11 +05:30
Jean Boussier
a2cb0b23b7
Merge pull request #42769 from Shopify/rails-7-default-partial-inserts
Disable Active Record partial_inserts by default in Rails 7.0
2021-07-13 11:04:30 +02:00
Jean Boussier
91082730cc Disable Active Record partial_inserts by default in Rails 7.0
Ref: https://github.com/rails/rails/pull/42355

The justification for `partial_inserts` back in 2012
(144e8691cbfb8bba77f18cfe68d5e7fd48887f5e) was:

> This is more efficient, and also means that it will be safe to remove
> database columns without getting subsequent errors in running app processes
> (so long as the code in those processes doesn't contain any references to the
> removed column).

But since then `ignored_columns` is a much more reliable way to safely remove a
column, and I doubt the reduced query size really help much.

Additionally, `partial_inserts` prevent removing the default value of a column
in a safe way.
2021-07-13 11:02:12 +02:00
Zachary Scott
02b7746e6f
Merge pull request #42756 from tywhang/more_accurate_error_for_missing_file_changelog_entry
Add CHANGELOG message for PR #41283
2021-07-13 15:03:48 +09:00
Zachary Scott
bd720c9791
Merge pull request #42760 from ghiculescu/patch-4
Add CHANGELOG for #42674
2021-07-13 15:02:43 +09:00
Jonathan Hefner
2ddcaa1a6f
Merge pull request #42754 from FestaLab/active-storage-requirements
Add 'requirements' subsection to active storage guide [ci-skip]
2021-07-12 14:32:54 -05:00
Breno Gazzola
f17a9aece6 Add 'requirements' subsection to active storage guide 2021-07-12 16:25:28 -03:00
Ryuta Kamizono
04121a5f30
Merge pull request #42762 from ghiculescu/patch-5
Add docs for `attr_readonly`
2021-07-13 03:34:01 +09:00
Alex Ghiculescu
647f4bd17f Add docs for attr_readonly
From https://github.com/rails/rails/pull/42705#issuecomment-878415276 - explicitly call out that assigning attributes works, but is ignored by saves.

Co-authored-by: Petrik de Heus <petrik@deheus.net>
2021-07-12 12:56:25 -05:00
Ryuta Kamizono
e06706201a
Merge pull request #42765 from p8/activerecord/fix-reflection-warning-message
Fix spelling in compute_class warning
2021-07-13 02:52:31 +09:00
Petrik
a2fca818c7 Fix spelling in compute_class warning 2021-07-12 19:38:28 +02:00
Eileen M. Uchitelle
5e41b028c8
Merge pull request #42763 from eileencodes/revert-40445
Revert "Merge pull request #40445 from robertomiranda/destroy_all-in_…
2021-07-12 13:36:42 -04:00
Ryuta Kamizono
adb9fc5773 Remove undefined ensure_zeitwerk_mode
Follow up to 8db23109bf61052eef437629b6ef27a94e0b5bd9.
2021-07-13 02:19:47 +09:00
John Hawthorn
2379bc5d2a Avoid using class var in LoggerThreadSafeLevel
Class variables are confusing and can be slow. In this case we were just
using the class variable as a global to implement Fiber-local variables
on top of. Instead we can use Thread#[] directly to store our Fiber-locals.
2021-07-12 10:18:02 -07:00
eileencodes
eb50860fe9
Revert "Merge pull request #40445 from robertomiranda/destroy_all-in_batcches"
This reverts commit 1cdee90d385399083596c22343cc46f51283aca3, reversing
changes made to c3a1bfe187d594ed2c2348cc0ae6c5c894368b8e.

We are reverting this because it caused a change in behavior and we need
to discuss how to address that behavior change and find a work around
that doesn't break existing applications.
2021-07-12 13:15:13 -04:00
Jean Boussier
cce46f8db1
Merge pull request #42459 from ghiculescu/patch-2
Log a warning when assertions are incorrectly nested and errors are raised
2021-07-12 19:05:39 +02:00
Ted
0c528034cf
Update actionview/CHANGELOG.md
Co-authored-by: Petrik de Heus <petrik@deheus.net>
2021-07-12 09:16:25 -07:00
Alex Ghiculescu
4b42beb3b8 Log a warning when assertions are incorrectly nested and errors are raised
Follow up to https://github.com/rails/rails/pull/37313

- Adds regression tests
- Logs a warning in cases where assertions are nested in a way that's likely to be confusing
2021-07-12 10:37:43 -05:00
Alex Ghiculescu
32ff2c2bf3
Add CHANGELOG for #42674
Fixes https://github.com/rails/rails/pull/42674#issuecomment-877714992

cc @zzak
2021-07-12 10:23:58 -05:00
Eileen M. Uchitelle
d364cfb34e
Merge pull request #42672 from jonathanhefner/system-testing-browser-iff-selenium
Configure browser only when using Selenium
2021-07-12 10:05:05 -04:00
Ted
141a0859f8
Add CHANGELOG message for PR #41283 2021-07-11 19:04:52 -07:00
Xavier Noria
8db23109bf Removes unnecessary calls to zeitwerk_enabled?
In Rails 7 zeitwerk_enabled? returns true unconditionally. It exists to let 3rd
party code supporting multiple Rails versions check, but we no longer need to use
it internally.
2021-07-11 22:40:23 +02:00
Jonathan Hefner
d9e188dbab
Merge pull request #42749 from pocke/_CI_skip__Add___see_below___notations_to_threading_documentation
[CI skip] Add `(see below)` notations to threading documentation
2021-07-10 10:22:01 -05:00
Masataka Pocke Kuwabara
e2f9807e77
[CI skip] Add (see below) notations to threading documentation
Co-authored-by: Jonathan Hefner <jonathan@hefner.pro>
2021-07-11 00:01:12 +09:00
Jonathan Hefner
39ceb5da54
Merge pull request #42735 from FestaLab/improve-active-storage-guide
Update active storage guide to match recent PRs [ci-skip]
2021-07-09 16:50:33 -05:00
Breno Gazzola
a3de68b66b Update active storage guide to match recent PRs 2021-07-09 15:44:36 -03:00
Zachary Scott
d45baa3444 💅 remove space before colon on config list 2021-07-09 16:39:42 +09:00
Jonathan Hefner
afc6abb674
Merge pull request #42736 from FestaLab/improve-contributing-guide
Ask contributors to update the documentation [ci-skip]
2021-07-08 15:02:56 -05:00
Breno Gazzola
74acfa394f Ask contributors to update the documentation 2021-07-08 16:53:50 -03:00
Ryuta Kamizono
de8d345323
Merge pull request #42726 from dark-panda/truncate-actioncable-server-logging
Truncate more ActionCable broadcast messages to 300 chars
2021-07-09 02:43:15 +09:00
Ryuta Kamizono
f01166ddea
Merge pull request #42728 from ghiculescu/patch-4
Handle paths with spaces when editing credentials
2021-07-09 02:12:01 +09:00
Ryuta Kamizono
f189e4c4a4
Merge pull request #42733 from okuramasafumi/small-improvements-on-active-model
Small improvements on active model
2021-07-09 02:03:57 +09:00
Alex Ghiculescu
5ca37eae12 Handle paths with spaces when editing credentials
Fixes https://github.com/rails/rails/issues/41617

Co-authored-by: Alexander Riccio <alexander@riccio.com>
Co-authored-by: Jonathan Hefner <jonathan@hefner.pro>
2021-07-08 11:47:44 -05:00
OKURA Masafumi
67adc94e00 Add :nodoc to ActiveModel::Errors
Three classes in `active_model/errors` look internal only.
2021-07-09 00:01:10 +09:00
OKURA Masafumi
f96929ae5f Add missing require to active_model/naming
Using `delegate` at L151 causes `NoMethodError`.
Adding `require` resolves this.
2021-07-08 23:02:09 +09:00
Jean Boussier
317547e0e7
Merge pull request #42729 from Shopify/fix-has-many-inversing-remove
Fix clearing the inverse relation when has_many_inversing is enabled
2021-07-08 12:18:14 +02:00
Jean Boussier
6d7235dd20 Fix clearing the inverse relation when has_many_inversing is enabled
https://github.com/rails/rails/pull/42601 fixed clearing the inverse relation,
but it didn't account for collection associations.

For these, just assigning `nil` isn't possible because we need the record to
remove it from the collection.

So this PR introduce an explicit method for this purpose rather than
reuse `inversed_from(nil)`.
2021-07-08 11:25:32 +02:00