Commit Graph

91950 Commits

Author SHA1 Message Date
Yasuo Honda 63db7d53c3
Merge pull request #52039 from yahonda/pin_sprockets_rails_to_342
Pin `sprockets-rails` version to 3.4.2 or lower
2024-06-07 10:02:29 +09:00
Yasuo Honda a76e272794 Pin `sprockets-rails` version to 3.4.2 or lower
This commit pins `sprockets-rails` version to 3.4.2
until https://github.com/rails/sprockets-rails/issues/524 is fixed.

Refer to https://github.com/rails/rails/issues/52038
2024-06-07 09:37:50 +09:00
Gannon McGibbon 743128b230
Merge pull request #52033 from Shopify/amend_lazy_routes_changelog
Changelog tweak for lazy routes
2024-06-06 14:07:45 -05:00
fatkodima c5ac244c0d Fix running migrations on other databases when `database_tasks: false` on primary 2024-06-06 21:00:54 +03:00
John Hawthorn edc7018742 Add ActiveSupport::TimeZone#dst?
Like abbr, this is used by Ruby when specifying creating a ::Time with a
zone object.
2024-06-06 10:51:18 -07:00
John Hawthorn 262713413c Add ActiveSupport::TimeZone#abbr
As of Ruby 2.6, ::Time supports rich timezone objects and expects them
to follow a similar API to tzinfo. Mostly we already do this with
ActiveSupport::TimeZone, delegating to the underlying tzinfo object,
except we were missing the API to display the timezone's name.

Calling strftime with "%Z" will try the following on the timezone:
* zone.abbr(time)
* zone.strftime("%Z", time)
* zone.name

Because we only implemented name, a ::Time created with an
ActiveSupport::TimeZone would "abbreviate" awkwardly to the full tz
identifier (like "12:34:00 America/Vancouver" instead of "12:34:00
PDT"). This commit implements abbr to make these Times format the same
way as TimeWithZone.

Co-authored-by: Jason Kim <jasonkim@github.com>
2024-06-06 10:43:34 -07:00
Earlopain d56adb8d56 Changelog tweak for lazy routes
Adds context to the changelog that eager-loaded envs will draw routes
eagerly like they did previously.
2024-06-06 11:37:31 -05:00
Gannon McGibbon 6622075802
Merge pull request #52012 from Shopify/defer_route_drawing
Defer route drawing to the first request, or when url_helpers called.
2024-06-06 11:23:47 -05:00
Eileen M. Uchitelle 5dabff4b7b
Merge pull request #51167 from Jay0921/fix-preload-ids-reader-composite-pk
[Fix #51129] Fix issue with IDs reader on preloaded associations for composite primary keys
2024-06-05 07:55:08 -07:00
Carlos Antonio da Silva d36c752287 Add ensure to reset table name in tests 2024-06-05 11:03:18 -03:00
Carlos Antonio da Silva fd5542ee1c Remove changelog, change backported to 7-2-stable
[ci skip]
2024-06-05 11:03:18 -03:00
Carlos Antonio da Silva 6802fac3cd
Merge pull request #52024 from Earlopain/explicit-logger-dep
Add an explicit dependency on the `logger` gem
2024-06-05 10:51:59 -03:00
Earlopain d9adf17fbe
Add an explicit dependency on the `logger` gem
This is getting the same treatment as `base64`, `mutex_m`, etc.
In Ruby 3.4 it will start to warn: d7e558e3c4

Remoce require from two files that don't seem to need it
2024-06-05 13:53:33 +02:00
Vipul A M c628f77112
Merge pull request #52023 from majidalaeinia/main
Resolve Typo
2024-06-05 16:54:25 +05:30
Majid Alaeinia 5737cf9ce0
Update association_basics.md 2024-06-05 04:55:01 +03:30
Yasuo Honda a6a840f150
Merge pull request #51969 from npezza93/insert-all-fix
Parameterize table_name when constructing insert alias to avoid syntax error when table_name contains the database name for mysql
2024-06-05 08:32:23 +09:00
Rafael Mendonça França 8159498aea
Merge pull request #52020 from rails/rm-remove-networks
Remove the default network from the devcontainer compose
2024-06-04 15:55:51 -04:00
Rafael Mendonça França 5cfc1f8f56
Remove the default network from the devcontainer compose
And stop exposing the capybara server port to all interfaces.

We were using this just to make sure the selenium container can access
the capybara server but it can with the default bridge network.
2024-06-04 19:18:07 +00:00
Zack Deveau e215bf3360
Sanitize ActionText HTML ContentAttachment in Trix edit view
[CVE-2024-32464]
Instances of ActionText::Attachable::ContentAttachment included
within a rich_text_area tag could potentially contain unsanitized
HTML. This could lead to a potential cross site scripting issue
within the Trix editor.

This change enforces existing sanitization routines on
ActionText::Attachable::ContentAttachment attachments.
2024-06-04 10:08:12 -07:00
Zack Deveau 35858f1d9d
include the HTTP Permissions-Policy on non-HTML Content-Types
[CVE-2024-28103]

The application configurable Permissions-Policy is only
served on responses with an HTML related Content-Type.

This change allows all Content-Types to serve the
configured Permissions-Policy as there are many non-HTML
Content-Types that would benefit from this header.
(examples include image/svg+xml and application/xml)
2024-06-04 10:07:37 -07:00
Gannon McGibbon 7ac333858c Defer route drawing to the first request, or when url_helpers called.
Executes the first routes reload in middleware, or when the route set
url_helpers is called. Previously, this was executed unconditionally on
boot, which can slow down boot time unnecessarily for larger apps with
lots of routes.
2024-06-04 11:12:12 -05:00
Aaron Patterson f008c31717
Merge pull request #52015 from maniSHarma7575/51991-pluck-columns-should-correctly-casts-types-when-using-postgresql
[FIX] Pluck columns should correctly casts types when using postgresql
2024-06-04 08:55:29 -07:00
Rafael Mendonça França f4c39b5e2d
Merge pull request #51994 from matthewd/preserves-timezone-very-deprecated
Re-roll deprecation of to_time_preserves_timezone
2024-06-04 11:02:11 -04:00
Jay Ang 3e371c6dd6 Fix issue with IDs reader on preloaded associations for composite primary keys 2024-06-04 22:13:05 +08:00
Nick Pezza 7f4b396f4c
Parameterize table_name when constructing insert alias to avoid syntax error when table_name contains the database name 2024-06-04 09:26:49 -04:00
Petrik de Heus 5ade5d4173
Merge pull request #50785 from JunichiIto/add-note-to-params-hash
Add note about `params` hash in Action Controller Overview [ci skip]
2024-06-04 14:52:10 +02:00
maniSHarma7575 a35074e6f1 Fix test_pluck_functions_without_alias 2024-06-04 12:07:08 +05:30
maniSHarma7575 d7c02de1a3 Minimum in test case should be picked after conditions 2024-06-04 11:47:47 +05:30
maniSHarma7575 0077a167f6 [FIX] Pluck columns should correctly casts types when using postgresql 2024-06-04 11:37:04 +05:30
Xavier Noria 3769f1eee6
Merge pull request #52013 from rails/fxn/edit-transaction.active_record
Add usage guidelines to transaction.active_record docs
2024-06-03 23:23:22 +02:00
Xavier Noria 2a5b4fd6cb Add usage guidelines to transaction.active_record docs 2024-06-03 23:22:21 +02:00
Carlos Antonio da Silva 060d6ca4d1 Indent code examples to get proper doc code output / highlight
[ci skip]
2024-06-03 13:45:34 -03:00
Carlos Antonio da Silva 40a52362af
Merge pull request #52004 from duffuniverse/fix-typo-in-active-record-and-postgresql-guide
[ci skip] Fix a typo in Active Record and PostgreSQL guide
2024-06-03 13:31:02 -03:00
Xavier Noria 3f0b8ef7c0
Merge pull request #52007 from rails/fxn/blank-txn
Pass transaction: nil in sql.active_record events if no transaction i…
2024-06-03 17:50:43 +02:00
Xavier Noria 4a4ed0fb0e Pass transaction: nil in sql.active_record events if no transaction is open 2024-06-03 17:36:20 +02:00
Jean Boussier 0f3dbe2f97
Merge pull request #52005 from Shopify/transaction-blank
Fix `ActiveRecord::Transaction#blank?`
2024-06-03 15:12:59 +02:00
Eileen M. Uchitelle 9cafa55ddd
Merge pull request #51339 from gjtorikian/enable-n_plus_one_only-toggling
Allow one to set `strict_loading_mode` globally
2024-06-03 06:12:04 -07:00
Jean Boussier 570530996a Fix `ActiveRecord::Transaction#blank?`
Followup: https://github.com/rails/rails/pull/51968

The wrong method was aliased.
2024-06-03 15:04:41 +02:00
Andrey Sobolev e1f00d2a93
Fix a typo in Active Record and PostgreSQL guide 2024-06-03 15:16:30 +03:00
Xavier Noria f53d020c44 Copy-edit pass on the multiple databases guide
Main points:

* Applies our documentation guidelines (names of files, punctuation in comments, etc.)

* AnimalsRecord was introduced before the primary abstract class. Before this
  point, stuff related to the primary database is explained first, and then you
  go for the extra database. This is the natural order, I think. I reordered
  for consistency.

* PrimaryApplicationRecord was missing connects_to.

* Fixes parent class for the example related to PrimaryApplicationRecord.
2024-06-03 14:05:03 +02:00
Jean Boussier 2514bdef7b
Merge pull request #51968 from Shopify/current-transaction-doc
Clarify `current_transaction` behavior.
2024-06-03 12:37:15 +02:00
Jean Boussier e104356c73 Clarify `current_transaction` behavior.
The documentation wasn't making it clear that a `NullTransaction`
is returned when no transaction is active.

While we're not going to document `NullTransaction` itself, we can
more explictly explain that `current_transaction` always returns an
object that responds to the `ActiveRecord::Transaction` interface.
2024-06-03 10:30:55 +02:00
Garen J. Torikian 5ff9915db9
Allow one to set `strict_loading_mode` globally 2024-06-02 14:38:38 -05:00
Matthew Draper 595c3ccc47 Re-roll deprecation of to_time_preserves_timezone
We realised the previous deprecation hadn't been warning for all users.
2024-06-03 00:57:09 +09:30
Matthew Draper 43fcdfa4d0 Revert "Remove deprecated support for the pre-Ruby 2.4 behavior of `to_time`"
This reverts commit b1b2c6d59c.
2024-06-02 23:52:59 +09:30
Petrik de Heus 8336aa7f0b
Merge pull request #51989 from p8/activesupport/improve-alias-method-nodoc
Use `:nodoc:` for `alias_method` instead of `:stopdoc:` [ci-skip]
2024-06-01 14:25:22 +02:00
Petrik 4735418d0d Use `:nodoc:` for `alias_method` instead of `:stopdoc:` [ci-skip]
RDoc 6.7 now hides `alias_method`s marked with `:nodoc:`.
2024-06-01 11:49:38 +02:00
Jean Boussier d97fb459bd
Merge pull request #51985 from rails/revert-51966-exists-and-loaded
Revert "Optimize `ActiveRecord::Relation#exists?` with no conditions for loaded relations"
2024-06-01 10:35:40 +02:00
Jean Boussier 3b247873e2
Revert "Optimize `ActiveRecord::Relation#exists?` with no conditions for loaded relations" 2024-06-01 10:35:22 +02:00
Jean Boussier 0378b056de
Merge pull request #51966 from fatkodima/exists-and-loaded
Optimize `ActiveRecord::Relation#exists?` with no conditions for loaded relations
2024-06-01 10:26:22 +02:00