Commit Graph

83223 Commits

Author SHA1 Message Date
Julian Rubisch
66ff8b1439
Fix ChatRelayJob definition in Testing Guide
The `ChatRelayJob` under "14.3 Custom Assertions And Testing Broadcasts Inside Other Components" defined a `perform_later` method, which I think should just be `perform`.
2022-03-11 09:51:11 +01:00
Aaron Patterson
1bca3cc406
Merge pull request #44650 from tomhughes/relative-redirect
Allow relative redirects when `raise_on_open_redirects` is enabled
2022-03-10 09:10:55 -08:00
Jean Boussier
190291dc45
Merge pull request #44596 from fractaledmind/patch-1
Use #attribute_names in ActiveRecord::Core#inspect
2022-03-10 14:27:44 +01:00
Stephen Margheim
3c02ef95e9
Add test for inspecting a Relation with a virtual field 2022-03-10 11:35:51 +01:00
Tom Hughes
24ebaa4e83 Allow relative redirects when raise_on_open_redirects is enabled 2022-03-10 00:41:49 +00:00
Aaron Patterson
2c21a39493
Merge pull request #44387 from piecehealth/fix_activestorage_update
fix activestorage update
2022-03-09 16:12:48 -08:00
Aaron Patterson
212463d5e6
Merge pull request #44648 from kaiquekandykoga/docs-mattrs
Documentation mattr_(reader|writer|accessor)
2022-03-09 16:06:26 -08:00
Kaíque Kandy Koga
d89be419ba Add examples of default values using blocks for mattr_reader, mattr_writer and mattr_accessor 2022-03-09 18:58:08 -03:00
Aaron Patterson
2837572fab
Merge pull request #44647 from ghousemohamed/removed-unwanted-tempfile-requires
Removed unwanted requires of `tempfile` and fix rubocop errors
2022-03-09 12:12:31 -08:00
Ghouse Mohamed
42b2869d06 Removed unwanted requires of and fixed rubocop errors 2022-03-10 01:19:55 +05:30
Aaron Patterson
44e5a31d85
Merge pull request #44644 from tonobo/active_support_inheritable_options_add_dig
ActiveSupport::OrderedOptions handle custom #dig
2022-03-09 10:48:12 -08:00
Aaron Patterson
fa50f7c92f
Merge pull request #44643 from lewispb/action-mailbox-instrumentation
Instrument Action Mailbox processing
2022-03-09 10:45:43 -08:00
John Hawthorn
9070d563b9
Merge pull request #44617 from nholden/destroy-async-batch
Add `active_record.destroy_association_async_batch_size` configuration
2022-03-09 10:16:28 -08:00
Nick Holden
c773ae65af Add active_record.destroy_association_async_batch_size configuration
This allows applications to specify the maximum number of records that
will be destroyed in a single background job by the `dependent:
:destroy_async` association option. By default, the current behavior
will remain the same: when a parent record is destroyed, all dependent
records will be destroyed in a single background job. If the number of
dependent records is greater than this configuration, the records will
be destroyed in multiple background jobs.

At GitHub, we have a custom method for destroying associated records
in the background that we'd like to replace with
`dependent: :destroy_async`. Some associations have a large number of
dependent records, and our infrastructure requires that background jobs
complete quickly, so we limit the maximum number of dependent records
destroyed in a single background job and enqueue additional jobs when
the number of records exceeds that limit.
2022-03-09 11:13:16 -07:00
Eileen M. Uchitelle
7684256ede
Merge pull request #44637 from fatkodima/remove_foreign_key-if_exists
Fix `remove_foreign_key` with `:if_exists` option when foreign key actually exists
2022-03-09 09:22:02 -05:00
Tim Foerster
5c15b586aa
ActiveSupport::OrderedOptions handle custom #dig
Common access via #[](arg) is being casted to symbol, same behavior should be provided on using #dig in order be consistent
2022-03-09 12:42:03 +01:00
Lewis Buckley
599e73bc00
Instrument Action Mailbox processing
Use ActiveSupport::Notifications to instrument Action Mailbox for
logging or performance monitoring.
2022-03-09 10:06:43 +00:00
Aaron Patterson
8516bb6804
Merge pull request #44635 from imtayadeway/tjw/api-csp-i
Generate content security policy for non-HTML responses
2022-03-08 13:23:15 -08:00
Aaron Patterson
a65c31e537
Merge pull request #44639 from pvalena/patch-4
Add missing require to activerecord base_test.rb
2022-03-08 13:01:21 -08:00
Aaron Patterson
6b9ca00845
Merge pull request #44641 from SkipKayhil/fix-rubocop-errors
fix rubocop errors
2022-03-08 13:01:00 -08:00
Hartley McGuire
c3844a9dc0 fix rubocop errors
Using `bundle exec rubocop -a` and visually verified
2022-03-08 15:36:24 -05:00
Xavier Noria
9b76e93fea Modernizes wording in the autoloading guide 2022-03-08 20:27:46 +01:00
Zack
b2ab8dd3a4
Added image trasnformation validation via configurable allow-list
ImageProcessingTransformer now offers a configurable allow-list for
transformation methods in addition to a configurable deny-list for arguments.

[CVE-2022-21831]
2022-03-08 09:28:16 -08:00
Pavel Valena
afde7e3c0e
Add missing require to activerecord base_test.rb
as  silence_warnings  is used.
2022-03-08 17:28:51 +01:00
fatkodima
1f70f3cb8b Fix remove_foreign_key with :if_exists option when foreign key actually exists 2022-03-08 17:45:16 +02:00
Eileen M. Uchitelle
53566644f3
Merge pull request #44628 from vy0b0x/improve-the-documentation-and-guide-about-where-not
Improve the documentation and guide about where.not
2022-03-08 09:50:33 -05:00
Eileen M. Uchitelle
3b34fe285a
Merge pull request #44631 from SkipKayhil/fix-namespaced-protection
fix namespaced schema load ignoring protected env
2022-03-08 09:18:54 -05:00
Jean Boussier
c45de6268d
Merge pull request #44613 from Shopify/eager-load-routes-proxy-2
Fix eager loading of ActionDispatch::Routing
2022-03-08 13:16:26 +01:00
Jean Boussier
142876cd6f
Merge pull request #44551 from Shopify/error-reporter-disable
Implement ErrorReporter#disable
2022-03-08 13:16:07 +01:00
vy0b0x
891227cef8 Improve the documentation and guide about where.not 2022-03-08 04:22:55 +00:00
Hartley McGuire
85d371ed06 fix namespaced schema load ignoring protected env
This makes the task requirements for db:schema:load:namespace the same
as db:schema:load (adding check_protected_environments)
2022-03-07 19:46:07 -05:00
Tim Wade
acf7e0d2fe
Update actionpack/CHANGELOG.md
Co-authored-by: Alex Ghiculescu <alex@tanda.co>
2022-03-07 16:33:00 -08:00
Tim Wade
803f87567f
Generate content security policy for non-HTML responses
One feature of the content security policy DSL, though undocumented,
is that it will not generate headers for non-HTML responses, even if a
configuration is explicitly provided. While it may not seem obvious
that anyone would want to send this header in an API response, Mozilla
Observatory, for instance, recommends the following for API responses:

`Content-Security-Policy: default-src 'none'; frame-ancestors 'none'`

(source: https://observatory.mozilla.org/faq/)

The Secure Headers gem also makes recommendations about the content
security policy for API responses: https://github.com/github/secure_headers#api-configurations

As such, this removes the HTML guard clause from the
`ContentSecurityPolicy` middleware.
2022-03-07 16:24:14 -08:00
Rafael Mendonça França
b2669d7361
Merge pull request #44633 from ghiculescu/revert-43216
Remove `--no-comments` from Postgres structure dump command
2022-03-07 14:07:34 -05:00
Alex Ghiculescu
c94ac46cd8 Remove --no-comments from Postgres structure dumps
Reverts https://github.com/rails/rails/pull/43216
Fixes https://github.com/rails/rails/issues/44498

Per the discussion at https://github.com/rails/rails/pull/44603#discussion_r820875837, reverting the feature as it's not clear it should be the default. Users who don't want comments in structure dumps can use `ActiveRecord::Tasks::DatabaseTasks.structure_dump_flags = ['--no-comment']`.
2022-03-07 12:40:12 -06:00
Jean Boussier
6bbf8d647d Implement ErrorReporter#disable
Ref: https://github.com/rails/rails/pull/43625#discussion_r809532572

It can be used by error reporting service integration when they wish
to handle the error higher in the stack.

For instance Sidekiq has its own error handling interface with a
little bit of extra context information.
2022-03-07 16:10:27 +01:00
Xavier Noria
645239817d Refactor Zeitwerk setup in Action Cable
I am trying to find a sweet spot here.

Personally, not quite satisfied by having lib/action_cable/zeitwerk.rb. At the
same time, trying to avoid too taking much space in lib/action_cable.rb.

This patch also moves

    require_relative "action_cable/version"

within ActionCable. Why? In a project, I like that the entrypoint defines the
namespace. That is the main file for that namespace.

Then, files below have it already created, and reopen it.

I just find this deliberate order of execution to be natural, hierarchical,
matching the project structure.
2022-03-06 19:52:36 +01:00
Jean Boussier
e17fe9eb6e
Merge pull request #44459 from lewispb/default-error-reporting-handled-kwarg
Set a default value for ActiveSupport::ErrorReporter#report handled kwarg
2022-03-06 16:46:31 +01:00
Eugene Kenny
e3fd639fea Fix invalid syntax in all_queries example [ci skip] 2022-03-05 14:38:54 +00:00
Xavier Noria
61bbcb71d5 Add missing magic comment (linting) 2022-03-05 14:25:52 +01:00
Xavier Noria
a0e75d76ab Setup Zeitwerk in a dedicated file 2022-03-05 14:05:34 +01:00
Xavier Noria
a3f4ae9a2d Remove require "thread" from Action Cable
Not needed since Ruby 2.1.
2022-03-05 08:56:09 +01:00
Xavier Noria
3ec6b6e80b
Merge pull request #44618 from rails/action-cable-zeitwerk
Load Action Cable with Zeitwerk
2022-03-05 08:38:50 +01:00
Xavier Noria
b7ae3cba6d Load with Zeitwerk 2022-03-05 08:19:49 +01:00
Rafael Mendonça França
2a98e28a31
Merge pull request #44615 from FestaLab/propshaft-assets
Do not remove assets initializer when using propshaft
2022-03-04 16:27:50 -05:00
Breno Gazzola
c744439631 Do not remove assets initializer when using propshaft 2022-03-04 14:43:29 -03:00
Jean Boussier
490f2b72cc Fix eager loading of ActionDispatch::Routing
Followup: https://github.com/rails/rails/pull/44612

As rightfully pointed out by @rafaelfranca
2022-03-04 17:41:36 +01:00
Jean Boussier
54c7357769
Merge pull request #44612 from Shopify/eager-load-routes-proxy
Eager load ActionDispatch::Routing::RoutesProxy
2022-03-04 16:32:32 +01:00
Jean Boussier
4b823e1a44 Eager load ActionDispatch::Routing::RoutesProxy
Otherwise it might only be loaded once `url_for` is called:
```
    from bundler/gems/rails-5772ecd7d568/actionpack/lib/action_dispatch/routing/routes_proxy.rb:7:in `<module:Routing>'
    from bundler/gems/rails-5772ecd7d568/actionpack/lib/action_dispatch/routing/routes_proxy.rb:6:in `<module:ActionDispatch>'
    from bundler/gems/rails-5772ecd7d568/actionpack/lib/action_dispatch/routing/routes_proxy.rb:5:in `<main>'
    from gems/bootsnap-1.10.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
    from gems/bootsnap-1.10.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
    from gems/zeitwerk-2.5.4/lib/zeitwerk/kernel.rb:35:in `require'
    from bundler/gems/rails-5772ecd7d568/actionpack/lib/action_dispatch/routing/polymorphic_routes.rb:214:in `polymorphic_method'
    from bundler/gems/rails-5772ecd7d568/actionpack/lib/action_dispatch/routing/polymorphic_routes.rb:116:in `polymorphic_url'
    from bundler/gems/rails-5772ecd7d568/actionpack/lib/action_dispatch/routing/url_for.rb:187:in `full_url_for'
    from bundler/gems/rails-5772ecd7d568/actionpack/lib/action_dispatch/routing/url_for.rb:170:in `url_for'
```
2022-03-04 16:11:57 +01:00
Jean Boussier
9feaf7eaae Fix a typo in http_basic_authenticate_with 2022-03-04 16:10:38 +01:00