If reloading is enabled, we need the interlock to synchronize reloads.
If reloading is disabled and so is eager loading, in the past you still needed
to synchronize autoloads because `classic` was not thread-safe. With Zeitwerk,
this is no longer needed.
Every time I write `config.cache_classes` I have to pause for a moment to make
sure I get it right. It makes you think.
On the other hand, if you read `config.enable_reloading = true`, does the
application reload? You do not need to spend 1 cycle of brain CPU to nod.
This functionality has been deprecated since Rails 6.1 and can now be
removed. I've deleted all code, docs, references, and tests related to
this feature.
After af7428c4acd0fcf9eed5c7215856594a078f23b7 the yarn install
instructions was dropped from bin/setup. This commmit adds it into
the setup script again if the user is not using importmap.
Rails 6.0 and Rails 6.1 didn't support the undocumented `before_remove_const` in
`zeitwerk` mode. I noticed this cleanup in AR was not being executed, and
restored the original code for Rails 7.
However, invoking `respond_to?` in an `on_unload` callback may have unexpected
side-effects, as seen in #44125. So, this patch reimplements the cleanup in a
more modern way.
Fixes#44125.
activerecord/lib/active_record/connection_adapters/postgresql/column.rb
- usage added in 64fd666
- unneeded because of active_support/rails: 8f58d6e
railties/lib/rails/rack/logger.rb
- usage added in c83d9a1
- usage removed in c131211
activesupport/lib/active_support/number_helper/number_converter.rb
- the NumberHelper was split into multiple classes in 2da9d67, however
the require was left in NumberConverter even though
NumberToPhoneConverter is the only class where it's used
activesupport/lib/active_support/duration/iso8601_serializer.rb
- usage added in 04c512d
- usage removed in 51e991f
- ### Summary
The terminal output on a Rails application running ruby 3 will be
cluttered with thousands of lines if one inadventarly call a
unexisting method.
This happen in various places (IntegrationTest, when running a db
migration ...).
This is related to a change in ruby 3 when a NoMethodError is
raised.
### Simple reproduction
```
class A
def initialize(session)
@a = session
end
end
test = A.new("*" * 36)
test.dsad # undefined method `dsad' for #<A:0x00007f847d8494b0 @a="************************************"> (NoMethodError)
# Note that the "#<A:0x00007f847d8494b0 @a="************************************">" part
# is 65 chars long.
test = test = A.new("*" * 37)
test.dsad # undefined method `dsad' for #<A:0x00007fa8c38299c0> (NoMethodError)
```
On Ruby < 3, the NoMethodError message (everything starting from the
"#" char) could only be 65 characters long. If it was above that
ruby would only output the name of the class and its address.
On Ruby >= 3, that limitation has been removed and the message can
be any length long.
### On Rails
Anytime a method is called on a object that holds the entire
Rails::Application, the terminal would output the entire application
which is annoying be can be dangerous because it will leak
everything containing the credentials (stored inside the Application
object).
This has the benefit of hiding the warning message from git when
initialBranch configuration is unset, and was a recommendation on the
original commit adding main as the default branch for generators.
Ref: eb261937ac856100b4e1c8a2dbb56aab6e5d140e
The `content_security_policy_report_only` config does not enable
violation reporting.
It makes sure the policy isn't enforced, only reported.
Also link to the guide instead of external documentation.
RDoc will automatically format and link API references as long as they
are not already marked up as inline code.
This commit removes markup from various API references so that those
references will link to the relevant API docs.
Rendering the list of boot steps as a code block confused the syntax
highlighter.
This commit changes the list to use RDoc's ordered list syntax, and adds
inline code markup as appropriate.
This almost never matters, but if the path-global 'rake' or 'rails'
points to a specific (and wrong) ruby version, (or, possible in CI,
there is no installed 'rails' executable), things get confused.
Instead, any time we mean "run a global 'rails', as for 'new'", use a
fully-qualified path to our in-tree copy. And any time we're working
inside an application, use the bin/rails script directly. It would be
equivalently valid to always use the one in exe/, because that handles
searching for bin/rails internally... but it's uglier to fully-qualify,
plus 'rake' would then be more complicated.
This ensures that the finish instrumenter is sent to the same
subscribers that the initial request was sent to.
This solves an issue where in a threaded environment the dynamic
subscriptions from ActionDispatch::ServerTiming would cause a mismatch
in the number of subscriptions to a topic, which would pop too many
values off of the thread-local stacks, leading to invalid events being
sent to subscribers.
Fixes#44167
These changes include adding a hybrid serializer class
named JsonWithMarshalFallback in order for existing apps
to have an upgrade path from Marshal to JSON.