Fix: https://github.com/rails/rails/issues/45092
Up until 3.0, `rails s` would always at least find webrick. But since it
was removed in Ruby 3.0, it's now possible to end up with no available server
at all.
In such case we should recommend adding puma to the Gemfile.
`--js` alias to `rails new --javascript ...`
Same as `-j`, e.g. `rails new --js esbuild ...`
`--skip-js` alias to `rails new --skip-javascript ...`
Same as `-J`, e.g. `rails new --skip-js ...`
Sdoc 2.4.0 supports a CSS badge that can be set by passing the version
as the HORO_BADGE_VERSION env variable.
The old badge image can be removed, as it no longer needs to be copied
by the docs server: https://github.com/rails/rails-docs-server/pull/28
In this commit, we are adding the option to set the name of the app
when generating a new one with `rails new`.
The option `--name` will override the application name to be different
from the folder name.
```
rails new my-app-folder --name=my-actual-app-name"
```
The command above will generate a
new Rails application in the folder `my-app-folder`, but the file
`config/application.rb` would have the following structure:
module MyActualAppName
class Application < Rails::Application
end
end
This option would be most useful when generating a Rails application in
the current folder:
```
rails new . --name=my-app
```
`Shellwords.escape` escapes unquoted spaces with a backslash, but
Windows does not treat backslash as an escape character. Escaping is
also a problem when paths are expressed in shortened 8.3 format (e.g.
`C:\Users\RubyOn~1\AppData\Local\Temp\...`) because a backslash will be
erroneously added before the `~`.
We can avoid the need to escape by using `system(command_name, *args)`
instead of `system(command_line)`, but we must still support
`ENV["EDITOR"]` values that embed command line arguments, such as
`subl -w`.
This commit changes to `system(command_name, *args)`, but uses
`Shellwords.split` to extract any embedded arguments from
`ENV["EDITOR"]`. This requires that Windows users put quotes around the
entire path of their editor if it contains spaces, such as:
```
SET EDITOR="C:\Program Files\Microsoft VS Code\Code.exe" -w
```
In other words, the following are **not** supported on Windows:
```
SET "EDITOR=C:\Program Files\Microsoft VS Code\Code.exe"
SET EDITOR=C:\Program Files\Microsoft VS Code\Code.exe
SET EDITOR=C:\"Program Files"\"Microsoft VS Code"\Code.exe -w
SET EDITOR=C:\Program^ Files\Microsoft^ VS^ Code\Code.exe -w
SET EDITOR=C:\Program` Files\Microsoft` VS` Code\Code.exe -w
```
Fixes#41617 (again).
Closes#44890.
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.