Commit Graph

90150 Commits

Author SHA1 Message Date
Will Jessop 7606002f13 Move singleton require.
ActiveSupport::Deprecation used to `include Singleton` which is why the require is here, but it was removed in 9812641891 (June 5 2023). Leaving the require seems to have been an oversight.

However, module ActiveJob::Serializers::ObjectSerializer does require Singleton and was relying on AS:Deprecation to require it. This PR just moves the require to the place it's actually used.
2023-12-30 12:02:01 +00:00
Hartley McGuire 590a675c4e
Merge pull request #50485 from hexdevs/ta/fix-fedora-instructions
docs: fix ImageMagick package name on fedora [ci-skip]
2023-12-29 17:55:40 -05:00
Hartley McGuire 224731232d
Merge pull request #50484 from G-Rath/patch-1
docs: update reference to `main` branch [ci skip]
2023-12-29 17:46:20 -05:00
Thiago Araujo dcdd1ef7c2 docs: fix ImageMagick package name on fedora [ci-skip]
this commit corrects the name of the ImageMagick package
on fedora (from `imagemagick` to `ImageMagick`).

ref: https://packages.fedoraproject.org/pkgs/ImageMagick/ImageMagick/
2023-12-29 14:14:15 -07:00
Gareth Jones e76c52a939
docs: update reference to `main` branch 2023-12-30 09:37:55 +13:00
Hartley McGuire f481353150
Merge pull request #50468 from fractaledmind/ar-persistence-docs
SQLite3 +returning+ documentation additions
2023-12-28 12:04:26 -05:00
Stephen Margheim 77800d1920 Update documentation for ActiveRecord persistence methods that accept +returning+ option to note that this is available for SQLite3 adapter as well
Co-authored-by: OuYangJinTing <ouyangshi95@foxmail.com>
2023-12-28 09:54:50 +01:00
Hartley McGuire 8034cac675
Fix railspect not validating alphabetical order
One of the original goals of these checks was to validate that
configuration stays in alphabetical order, as this provides a
deterministic order for the configuration to be validated against.

However, it appears there has been a regression in that check and it has
only been validating that configurations are present. This commit
restores the ordering check and then uses `railspect configuration . -a`
to fix the configurations that ended up out of order.
2023-12-27 21:25:05 -05:00
Jean Boussier 354d1c42b4
Merge pull request #50463 from Shopify/remove-sqlite3-production-warning
Remove SQLite production warning but leave production config disabled
2023-12-27 23:34:47 +01:00
Petrik de Heus e7f2db67ca
Merge pull request #50423 from p8/guides/link-to-query-matchers
Link to query assertions in testing guide [ci-skip]
2023-12-27 23:34:00 +01:00
Jean Boussier 6b446bee63 Remove SQLite production warning but leave production config disabled
There are valid use cases for running SQLite in production, however it must be done
with care, so instead of a warning most users won't see anyway, it's preferable to
leave the configuration commented out to force them to think about having the database
on a persistent volume etc.

Co-Authored-By: Jacopo Beschi <beschi.jacopo@gmail.com>
2023-12-27 23:32:18 +01:00
Jonathan Hefner 5b62994778
Merge pull request #50418 from the-spectator/buffered_checksum
Use buffered read while generating Blob checksum to improve memory
2023-12-26 12:38:17 -06:00
zzak 16ff9afb2e
Merge pull request #50275 from seanpdoyle/polymorphic-rename
Provide guidance for renaming classes in polymorphic associations [ci skip]
2023-12-25 08:01:15 +09:00
Akshay Birajdar 92138c40cc Use buffered read while generating checksum for blob 2023-12-22 08:43:58 +05:30
Jonathan Hefner b1d57fb8c8
Merge pull request #50425 from wildmaples/remove-unused-arg
Remove unused argument in .db_configs_with_versions
2023-12-21 16:23:24 -06:00
Maple Ong 9572fcb4a0 Remove unused argument 2023-12-21 16:47:32 -05:00
Petrik 557dacfff9 Link to query assertions in testing guide [ci-skip]
We can link to the recenlty added queries as edge guides link to edge
API docs.
For readability the links are extracted.
2023-12-21 18:05:19 +01:00
OKURA Masafumi d9c63917b9
Doc: Prevent `Attributes` to be a link [ci-skip] (#50419)
This `Attributes` is not related to ActiveRecord's `attribute` API.
2023-12-21 16:51:20 +01:00
Jean Boussier 60df08920f
Merge pull request #50373 from fatkodima/improve-queries-assertions-matchers
Expose `assert_queries_match` and `assert_no_queries_match` assertions
2023-12-21 12:59:10 +01:00
Jean Boussier 6c0f897293
Merge pull request #50410 from fatkodima/fix-async-queries-with-query-cache
Fix async queries to work with query cache
2023-12-21 10:53:33 +01:00
fatkodima f48bbff32c Expose `assert_queries_match` and `assert_no_queries_match` assertions 2023-12-21 01:30:16 +02:00
fatkodima f68727dcd0 Fix async queries to work with query cache 2023-12-20 23:50:41 +02:00
Jonathan Hefner bf725a7876
Merge pull request #50404 from jonathanhefner/bump-psych-5_1_2
Bump `psych` gem to 5.1.2
2023-12-19 18:33:48 -06:00
Jonathan Hefner e589b1fbf5
Merge pull request #50403 from jonathanhefner/follow-up-46530
Fix inclusion of `url_helpers` module in concern
2023-12-19 18:13:10 -06:00
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 76c26135b9 Fix inclusion of url_helpers module in concern
Follow-up to #46530.

The dynamically generated `url_helpers` module is an
`ActiveSupport::Concern`.  Therefore, when it is included directly in
another `ActiveSupport::Concern`, its `included` block is deferred until
the latter concern is itself included elsewhere.  Thus, in that case,
the call to `base._routes` in `def self.included(base)` will raise
`NoMethodError` because the `included` block will not yet have defined
the `_routes` method.

This commit prevents the error by first checking if `base` responds to
`_routes`.
2023-12-19 17:43:32 -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