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.
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.
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.
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
$
```
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.
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.
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)
- 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.
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
```
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`.
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>
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.
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.