Commit Graph

90074 Commits

Author SHA1 Message Date
Jonathan Hefner adf10e9406 Bump psych gem to 5.1.2
This fixes the following error for the guides build:

  ```
  Traceback (most recent call last):
    13: from bug_report_templates/action_controller.rb:5:in `<main>'
    12: from /usr/local/bundle/gems/bundler-2.4.22/lib/bundler/inline.rb:42:in `gemfile'
    11: from /usr/local/bundle/gems/bundler-2.4.22/lib/bundler.rb:403:in `with_unbundled_env'
    10: from /usr/local/bundle/gems/bundler-2.4.22/lib/bundler.rb:649:in `with_env'
     9: from /usr/local/bundle/gems/bundler-2.4.22/lib/bundler.rb:403:in `block in with_unbundled_env'
     8: from /usr/local/bundle/gems/bundler-2.4.22/lib/bundler/inline.rb:51:in `block in gemfile'
     7: from /usr/local/bundle/gems/bundler-2.4.22/lib/bundler/settings.rb:142:in `temporary'
     6: from /usr/local/bundle/gems/bundler-2.4.22/lib/bundler/inline.rb:66:in `block (2 levels) in gemfile'
     5: from /usr/local/bundle/gems/bundler-2.4.22/lib/bundler/runtime.rb:24:in `setup'
     4: from /usr/local/bundle/gems/bundler-2.4.22/lib/bundler/runtime.rb:24:in `map'
     3: from /usr/local/bundle/gems/bundler-2.4.22/lib/bundler/spec_set.rb:165:in `each'
     2: from /usr/local/bundle/gems/bundler-2.4.22/lib/bundler/spec_set.rb:165:in `each'
     1: from /usr/local/bundle/gems/bundler-2.4.22/lib/bundler/runtime.rb:25:in `block in setup'
  /usr/local/bundle/gems/bundler-2.4.22/lib/bundler/runtime.rb:304:in `check_for_activated_spec!': You have already activated psych 5.1.1.1, but your Gemfile requires psych 5.1.2. Prepending `bundle exec` to your command may solve this. (Gem::LoadError)
  ```

This is similar to #45052.  Eventually, this should be fixed permanently
by either rubygems/rubygems#5529 or rubygems/rubygems#5535.
2023-12-19 18:03:51 -06:00
Jonathan Hefner b0048c787a Capitalize "Rails" [ci-skip] 2023-12-19 13:16:47 -06:00
Jonathan Hefner bf6c20edb7 Replace backticks with RDoc markup [ci-skip] 2023-12-19 13:16:47 -06:00
Jean Boussier 18b8f37192
Merge pull request #50395 from Shopify/fix-find-or-create
Fix `Relation#transaction` to not apply a default scope
2023-12-19 11:50:54 +01:00
Jean Boussier 8c9ff7cdd8 Fix `Relation#transaction` to not apply a default scope
Fix: https://github.com/rails/rails/issues/50368

When called on a scope it would go through the default scoping
delegator that applies a default scope, which make no sense.
2023-12-19 11:29:39 +01:00
Petrik de Heus 462e8e8b1c
Merge pull request #50367 from mechanicles/update-api-doc-for-activerelation-none-any-one
Update API doc for ActiveRecord::Relation#none?/#any?/#one? [ci-skip]
2023-12-18 08:26:21 +01:00
Santosh Wadghule 45ce025274
Update API doc for ActiveRecord::Relation#none?/#any?/#one? [ci-skip]
I checked https://github.com/rails/rails/issues/50327 and noticed that
clear API docs are needed. Some developers are using these methods
incorrectly, thinking they're only for Active Record Relation, but they
actually work with Enumerable.
2023-12-18 11:42:57 +05:30
David Heinemeier Hansson 2ec0ff42be
Add webp and avif as allowed formats for active storage to serve inline (#50265) 2023-12-17 17:39:04 -08:00
Hartley McGuire 1247932c80
Merge pull request #50360 from skipkayhil/hm-docs-deprecations
Improve Deprecation API docs and guide [ci-skip]
2023-12-17 17:10:21 -05:00
Yasuo Honda a7f1d63a3b
Merge pull request #50378 from yahonda/diag_build_102575
Ignore warnings like `warning: net-smtp which is not part of the default gems since Ruby 3.1.0.`
2023-12-17 23:10:59 +09:00
Yasuo Honda 08abd0da32
Merge pull request #50381 from fatkodima/fix-active_record_migrations-template
Fix `guides/active_record_migrations.rb` template to use the current migrations version
2023-12-17 23:10:20 +09:00
fatkodima a69228efa4 Fix `guides/active_record_migrations.rb` template to use the current migrations version 2023-12-17 11:36:10 +02:00
Yasuo Honda 6341e2dbb8 Ignore warnings like `warning: net-smtp which is not part of the default gems since Ruby 3.1.0.`
This commit addresses the CI failure against Ruby master branch.
https://buildkite.com/rails/rails/builds/102575#018c4147-8760-48ac-812c-4e63fbe242fa

This failure reproduces since this commit:
d411d8f5fe

* Steps to reproduce

Install `ruby 3.3.0dev`
```ruby
git clone https://github.com/rails/rails
cd rails/railties
rm ../Gemfile.lock
bundle
bin/test test/application/bin_setup_test.rb -n test_bin_setup_output
```

* Without this commit

```ruby
$ ruby -v
ruby 3.3.0dev (2023-12-16T21:45:33Z master d7d10f3ee8) [x86_64-linux]
$ rm ../Gemfile.lock ; bundle ; bin/test test/application/bin_setup_test.rb -n test_bin_setup_output
... snip ...
F

Failure:
ApplicationTests::BinSetupTest#test_bin_setup_output [/home/yahonda/src/github.com/rails/rails/railties/test/application/bin_setup_test.rb:51]:
--- expected
+++ actual
@@ -2,10 +2,12 @@
 The Gemfile's dependencies are satisfied

 == Preparing database ==
+/home/yahonda/.rbenv/versions/trunk/lib/ruby/gems/3.3.0+0/gems/zeitwerk-2.6.12/lib/zeitwerk/kernel.rb:38: warning: mutex_m was loaded from the standard library, but will no longer be part of the default gems since Ruby 3.4.0. Add mutex_m to your Gemfile or gemspec.
 Created database 'app_development'
 Created database 'app_test'

 == Removing old logs and tempfiles ==
+/home/yahonda/.rbenv/versions/trunk/lib/ruby/gems/3.3.0+0/gems/zeitwerk-2.6.12/lib/zeitwerk/kernel.rb:38: warning: mutex_m was loaded from the standard library, but will no longer be part of the default gems since Ruby 3.4.0. Add mutex_m to your Gemfile or gemspec.

 == Restarting application server ==
 "

bin/test test/application/bin_setup_test.rb:30

Finished in 12.553516s, 0.0797 runs/s, 0.0797 assertions/s.
1 runs, 1 assertions, 1 failures, 0 errors, 0 skips
$
```
2023-12-17 15:43:38 +09:00
Yasuo Honda d88f108690
Merge pull request #50377 from rails/revert-50331-lock_bigdecimal_314
Revert "Lock `bigdecimal` version to 3.1.4 or lower"
2023-12-17 15:23:44 +09:00
Yasuo Honda 17846afaa5
Merge pull request #50376 from skipkayhil/hm-bug-templates-missing-sqlite
Add sqlite3 back to bug templates that need it
2023-12-17 15:23:07 +09:00
Yasuo Honda cd5a698c4b
Revert "Lock `bigdecimal` version to 3.1.4 or lower" 2023-12-17 15:05:47 +09:00
Hartley McGuire c7ff8b975b
Add sqlite3 back to bug templates that need it
The sqlite3 gem was removed during the merging of main and gem
templates, but the resulting templates still depend on it.
2023-12-17 00:10:22 -05:00
Hartley McGuire 0a67279c32
Merge pull request #50374 from euglena1215/fix-contributing-template-link
Replace outdated links with correct links
2023-12-17 00:08:54 -05:00
Teppei Shintani 6be1c14c5c Replace outdated links with correct links
The changes to 860ab28ff5 have merged the bug report templates into one.
Since the template for the main branch has been removed, the link that was previously in CONTRIBUTING.md is invalid.

So I replaced them with the changed links.
2023-12-17 13:39:05 +09:00
Jean Boussier 32afa64e17
Merge pull request #49986 from seanpdoyle/action-view-bug-report-templates
Add `actionview` bug report template
2023-12-16 19:33:31 +01:00
Sean Doyle fe2632f340 Add `actionview` bug report template
Introduce Action View bug report template for contributors to reproduce
issues with failing `ActionView::TestCase` instances.

In addition to rendering ERB with the `inline:` keyword, the sample
tests also include a `Helpers` module to demonstrate how to incorporate
view helpers into the reproduction script.
2023-12-16 10:16:10 -05:00
Jean Boussier 860ab28ff5
Merge pull request #50317 from zzak/consolidate-bug_reports
Consolidate bug_report_templates and remove the gem versions
2023-12-16 13:55:26 +01:00
Petrik de Heus 4876fbd007
Merge pull request #50365 from mkasberg/action-mailer-guide
Document `action_mailer.file_settings` [ci-skip]
2023-12-16 12:46:09 +01:00
Mike Kasberg 6fda7ade58 Document `action_mailer.file_settings` [ci-skip]
I was reading the Action Mailer guide and noticed the settings and
defaults for the `:file` delivery method were poorly documented. These
docs were originally added back in #13728. #44422 added links to the
relevant sections of the Configuration guide, but did not link
`config.action_mailer.file_settings` because the Configuration guide is
actually missing that section.

I added a short section to the Configuration guide for
`config.action_mailer.file_settings` and linked to it from the Action
Mailer guide, following the style of the other delivery methods. Like
other delivery methods, the relevant options for `file_settings` come
from the allowed options of the `Mail::FileDelivery` class in the mail
gem.

Here's where Rails sets up this delivery method with the default
location:
9064735ec5/actionmailer/lib/action_mailer/delivery_methods.rb (L30-L31)

And here's where the mail gem uses the options:
10a4443b9d/lib/mail/network/delivery_methods/file_delivery.rb (L21)
2023-12-15 08:31:07 -07:00
Hartley McGuire f93eb16564
Improve Deprecation API docs and guide
- Link to Deprecation::Behavior in configuring guide

  The current list of options for `config.active_support.deprecation`
  was missing the newly added `:report` option. Instead of adding the
  missing option and continuing to keep 4 different lists of the same
  options in sync, I opted to replace the list with a link to the
  options in the Behavior API docs. This had the additional advantage of
  giving more information about all of the options which was not
  mentioned in the Configuring guide.

- Use symbols for Behavior options

  It felt to me like naming the options did not make it explicit that
  those were the symbols to pass to `#behavior=`, but by adding the `:`
  that becomes more clear.

- Add some API links

  There were a few references to `behavior=`, but we may as well link to
  the actual method.
2023-12-14 17:10:44 -05:00
Jean Boussier 9064735ec5
Merge pull request #49346 from fractaledmind/ar-sqlite-virtual-columns
Add support for generated columns in SQLite3 adapter
2023-12-14 18:34:23 +01:00
Stephen Margheim 4e7bdcf93a Add support for generated columns in SQLite3 adapter
Generated columns (both stored and dynamic) are supported since version 3.31.0 of SQLite.
This adds support for those to the SQLite3 adapter.

```ruby
create_table :users do |t|
  t.string :name
  t.virtual :name_upper, type: :string, as: 'UPPER(name)'
  t.virtual :name_lower, type: :string, as: 'LOWER(name)', stored: true
end
```
2023-12-14 18:19:02 +01:00
Jean Boussier b9cc0a2625
Merge pull request #50359 from flavorjones/serve-svg-with-compression_rebase
feature: Allow serving compressed SVG images (rebased)
2023-12-14 17:54:05 +01:00
Georg Ledermann 0fc5b06c08
Allow serving compressed SVG images
This adds `image/svg+xml` to the compressible content types
of ActionDispatch::Static

Co-authored-by: Mike Dalessio <mike.dalessio@gmail.com>
2023-12-14 11:38:07 -05:00
Jean Boussier 9517841bc3
Merge pull request #50334 from yykamei/add_doc_for_assert_queries
Add doc for `assert_queries` and `assert_no_queries`
2023-12-14 16:43:15 +01:00
Jean Boussier 970126e07e
Merge pull request #50336 from fatkodima/schema_dumper-dump-global-out
Change `SchemaDumper.dump` default stream to `$stdout`
2023-12-14 16:41:23 +01:00
fatkodima fa32da934a
Merge pull request #50357 from siaw23/document_assert_no_queries_assert_queries
Document assert_queries and assert_no_queries [ci-skip]
2023-12-14 16:23:10 +02:00
Emmanuel Hayford 03f2b75417 Document assert_queries and assert_no_queries [ci-skip] 2023-12-14 15:10:53 +01:00
Jean Boussier eb32f1ec40
Merge pull request #50356 from Shopify/fix-async-none-pluck
Fix `Model.none.async_pluck` to return a Promise
2023-12-14 12:51:28 +01:00
Jean Boussier f8e842f13e Fix `Model.none.async_pluck` to return a Promise
Previously it would return a naked empty array, which is a break
of the interface.
2023-12-14 12:36:42 +01:00
Jean Boussier 5a1b2b8e50
Merge pull request #50353 from lucasmazza/lm/fix-load-async-null-relation
Fix `load_async` for null relations
2023-12-14 12:33:25 +01:00
Yutaka Kamei ccc512f6d6
Add doc for `assert_queries` and `assert_no_queries`
Follow-up to #50281

I think `assert_queries` and `assert_no_queries` are so useful that I
want to read the documentation for the assertions. This patch adds the
doc for them and updated the test case named `test_assert_queries` to
verify `:matcher` works as expected.

I also changed `assert_queries` to make sure the subscriber of
`"sql.active_record"` is unsubscribed without affecting other test
cases. Without this change, some test cases fail because of execution of
`String#match`, which may cause `ArgumentError: invalid byte sequence in UTF-8`.
2023-12-14 09:09:16 +09:00
John Hawthorn 66e5ed7fa9
Merge pull request #50352 from dustinbrownman/main
Prevent duplicate records when preloading `:has_many` association
2023-12-13 16:04:33 -08:00
Lucas Mazza c755144201
Fix `load_async` for null relations
Fixes https://github.com/rails/rails/issues/50351
2023-12-13 20:38:41 -03:00
Dustin Brown f5f48cb8a5 Prevent duplicate records when preloading has_many
When preloading a has_many association, we were simply concatenating
the preloaded records without regard to whether they were already
loaded on the owner. Even though there is a check for `loaded?` in this
part of the preloader, some persisted records may not be marked as such.
For example, if a record is created via `owner.association.create`. This
change reverts to the previous behavior of replacing the target
association while also preserving non-persisted records, which was the
goal of https://github.com/rails/rails/pull/50129.

Co-authored-by: John Hawthorn <john@hawthorn.email>
2023-12-13 21:59:53 +00:00
Jean Boussier ee65e97829 Fix a typo in a comment 2023-12-13 18:04:39 +01:00
Jean Boussier bec5cde275
Merge pull request #50349 from Shopify/trilogy-socket-conn
TrilogyAdapter: ignore host if socket is set
2023-12-13 17:54:50 +01:00
Jean Boussier 0fe087eb56 TrilogyAdapter: ignore host if socket is set
Contrary to mysql2, trilogy will ignore the `socket` config
if `host` is set.

This makes it impossible to configure a UNIX domain socket connection
via `DATABASE_URL`, as the URL must include a host.
2023-12-13 17:35:09 +01:00
Eugene Kenny 8278626a2c
Merge pull request #49297 from hannahramadan/main
Add instrumentation for ActionController::Live#send_stream
2023-12-13 08:38:59 +00:00
hramadan 6488bd9ec0 Add instrumentation for ActionController::Live#send_stream
Allows subscribing to `send_stream` events.
The event payload contains the filename, disposition, and type.
2023-12-13 08:19:48 +00:00
Edouard Chin d4bf9f3993
Merge pull request #50340 from notapatch/pr-rails_on_rack_documentation
Update Rack::Head documentation to match code behavior [ci-skip]
2023-12-13 08:38:43 +01:00
notapatch cfdf868f92 Update Rack::Head documentation to match code behavior
In commit 449039a86d,
ActionDispatch::Head was replaced with Rack::Head in the
middleware. However, the documentation was not changed.

Rack::Head code behaviour is not to change HEAD into GET it is to
close the body of all HEAD requests. This commit fixes the docs
to show this.

The left-over ActionDisplayt::Head documentation is,
unsurprisingly, wrong. Rack::Head code behaviour is not to change
HEAD into GET it is to close the body of all HEAD requests.

This commit fixes the docs to show this.
2023-12-12 21:08:56 +00:00
fatkodima 306b2fc22e Change `SchemaDumper.dump` default stream to `$stdout` 2023-12-12 16:39:22 +02:00
Hartley McGuire 5316432444
Merge pull request #50335 from takmar/fix-engines-documentation
[ci skip] Update outdated documentation for Engines
2023-12-12 00:02:14 -05:00
Yasuo Honda 9715b861ef
Merge pull request #50331 from yahonda/lock_bigdecimal_314
Lock `bigdecimal` version to 3.1.4 or lower
2023-12-12 14:01:00 +09:00