rails/railties/CHANGELOG.md

251 lines
7.9 KiB
Markdown
Raw Normal View History

* Skip generating a `test` job in ci.yml when a new application is generated with the
`--skip-test` option.
*Steve Polito*
* Update the `.node-version` file conditionally generated for new applications to 20.11.1
*Steve Polito*
* Fix sanitizer vendor configuration in 7.1 defaults.
In apps where rails-html-sanitizer was not eagerly loaded, the sanitizer default could end up
being Rails::HTML4::Sanitizer when it should be set to Rails::HTML5::Sanitizer.
*Mike Dalessio*, *Rafael Mendonça França*
* Set `action_mailer.default_url_options` values in `development` and `test`.
Prior to this commit, new Rails applications would raise `ActionView::Template::Error`
if a mailer included a url built with a `*_path` helper.
*Steve Polito*
* Introduce `Rails::Generators::Testing::Assertions#assert_initializer`
Compliments the existing `initializer` generator action.
```rb
assert_initializer "mail_interceptors.rb"
```
*Steve Polito*
* Generate a .devcontainer folder and its contents when creating a new app.
The .devcontainer folder includes everything needed to boot the app and do development in a remote container.
The container setup includes:
- A redis container for Kredis, ActionCable etc.
- A database (SQLite, Postgres, MySQL or MariaDB)
- A Headless chrome container for system tests
- Active Storage configured to use the local disk and with preview features working
If any of these options are skipped in the app setup they will not be included in the container configuration.
These files can be skipped using the `--skip-devcontainer` option.
*Andrew Novoselac & Rafael Mendonça França*
* Introduce `SystemTestCase#served_by` for configuring the System Test application server
By default this is localhost. This method allows the host and port to be specified manually.
```ruby
class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
served_by host: "testserver", port: 45678
end
```
*Andrew Novoselac & Rafael Mendonça França*
* `bin/rails test` will no longer load files named `*_test.rb` if they are located in the `fixtures` folder.
*Edouard Chin*
* Ensure logger tags configured with `config.log_tags` are still active in `request.action_dispatch` handlers
*KJ Tsanaktsidis*
2024-02-01 22:45:49 +00:00
* Setup jemalloc in the default Dockerfile for memory optimization.
*Matt Almeida*, *Jean Boussier*
* Commented out lines in .railsrc file should not be treated as arguments when using
rails new generator command. Update ARGVScrubber to ignore text after # symbols.
*Willian Tenfen*
* Skip CSS when generating APIs.
*Ruy Rocha*
* Rails console now indicates application name and the current Rails environment:
```txt
my-app(dev)> # for RAILS_ENV=development
my-app(test)> # for RAILS_ENV=test
my-app(prod)> # for RAILS_ENV=production
my-app(my_env)> # for RAILS_ENV=my_env
```
The application name is derived from the application's module name from `config/application.rb`.
For example, `MyApp` will displayed as `my-app` in the prompt.
Additionally, the environment name will be colorized when the environment is
`development` (blue), `test` (blue), or `production` (red), if your
terminal supports it.
*Stan Lo*
2024-01-16 19:39:04 +00:00
* Ensure `autoload_paths`, `autoload_once_paths`, `eager_load_paths`, and
`load_paths` only have directories when initialized from engine defaults.
Previously, files under the `app` directory could end up there too.
*Takumasa Ochi*
* Prevent unnecessary application reloads in development.
Previously, some files outside autoload paths triggered unnecessary reloads.
With this fix, application reloads according to `Rails.autoloaders.main.dirs`,
thereby preventing unnecessary reloads.
*Takumasa Ochi*
2024-01-16 19:39:04 +00:00
* Use `oven-sh/setup-bun` in GitHub CI when generating an app with Bun.
*TangRufus*
2024-01-16 19:39:04 +00:00
* Disable `pidfile` generation in the `production` environment.
*Hans Schnedlitz*
2024-01-16 19:39:04 +00:00
* Set `config.action_view.annotate_rendered_view_with_filenames` to `true` in
the `development` environment.
*Adrian Marin*
2024-01-16 19:39:04 +00:00
* Support the `BACKTRACE` environment variable to turn off backtrace cleaning.
Useful for debugging framework code:
```sh
2024-01-16 19:39:04 +00:00
BACKTRACE=1 bin/rails server
```
*Alex Ghiculescu*
2024-01-16 19:39:04 +00:00
* Raise `ArgumentError` when reading `config.x.something` with arguments:
```ruby
config.x.this_works.this_raises true # raises ArgumentError
```
*Sean Doyle*
2024-01-16 19:39:04 +00:00
* Add default PWA files for manifest and service-worker that are served from `app/views/pwa` and can be dynamically rendered through ERB. Mount these files explicitly at the root with default routes in the generated routes file.
*DHH*
2024-01-01 04:05:54 +00:00
* Updated system tests to now use headless Chrome by default for the new applications.
*DHH*
2024-01-16 19:39:04 +00:00
* Add GitHub CI files for Dependabot, Brakeman, RuboCop, and running tests by default. Can be skipped with `--skip-ci`.
*DHH*
2024-01-16 19:39:04 +00:00
* Add Brakeman by default for static analysis of security vulnerabilities. Allow skipping with `--skip-brakeman option`.
*vipulnsward*
2024-01-16 19:39:04 +00:00
* Add RuboCop with rules from `rubocop-rails-omakase` by default. Skip with `--skip-rubocop`.
*DHH* and *zzak*
2024-01-16 19:39:04 +00:00
* Use `bin/rails runner --skip-executor` to not wrap the runner script with an
Executor.
*Ben Sheldon*
* Fix isolated engines to take `ActiveRecord::Base.table_name_prefix` into consideration.
This will allow for engine defined models, such as inside Active Storage, to respect
Active Record table name prefix configuration.
*Chedli Bourguiba*
2024-01-16 19:39:04 +00:00
* Fix running `db:system:change` when the app has no Dockerfile.
Fix running db:system:change with no Dockerfile The db:system:change command was [updated][1] to include support for changing the database packages installed in the Dockerfile. However, it never checks that the Dockerfile exists before trying to perform a substitution and will raise an error when its missing: ``` /home/hartley/.cache/asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/thor-1.3.0/lib/thor/actions/file_manipulation.rb:272:in `binread': No such file or directory @ rb_sysopen - /home/hartley/test/dev_minimal/Dockerfile (Errno::ENOENT) from /home/hartley/.cache/asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/thor-1.3.0/lib/thor/actions/file_manipulation.rb:272:in `gsub_file' from /home/hartley/src/github.com/skipkayhil/rails/railties/lib/rails/generators/rails/db/system/change/change_generator.rb:47:in `edit_dockerfile' from /home/hartley/.cache/asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/thor-1.3.0/lib/thor/command.rb:28:in `run' from /home/hartley/.cache/asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/thor-1.3.0/lib/thor/invocation.rb:127:in `invoke_command' from /home/hartley/.cache/asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/thor-1.3.0/lib/thor/invocation.rb:134:in `block in invoke_all' from /home/hartley/.cache/asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/thor-1.3.0/lib/thor/invocation.rb:134:in `each' from /home/hartley/.cache/asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/thor-1.3.0/lib/thor/invocation.rb:134:in `map' from /home/hartley/.cache/asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/thor-1.3.0/lib/thor/invocation.rb:134:in `invoke_all' from /home/hartley/.cache/asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/thor-1.3.0/lib/thor/group.rb:232:in `dispatch' from /home/hartley/.cache/asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/thor-1.3.0/lib/thor/base.rb:584:in `start' from /home/hartley/src/github.com/skipkayhil/rails/railties/lib/rails/commands/db/system/change/change_command.rb:20:in `perform' from /home/hartley/.cache/asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/thor-1.3.0/lib/thor/command.rb:28:in `run' from /home/hartley/.cache/asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/thor-1.3.0/lib/thor/invocation.rb:127:in `invoke_command' from /home/hartley/src/github.com/skipkayhil/rails/railties/lib/rails/command/base.rb:178:in `invoke_command' from /home/hartley/.cache/asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/thor-1.3.0/lib/thor.rb:527:in `dispatch' from /home/hartley/src/github.com/skipkayhil/rails/railties/lib/rails/command/base.rb:73:in `perform' from /home/hartley/src/github.com/skipkayhil/rails/railties/lib/rails/command.rb:71:in `block in invoke' from /home/hartley/src/github.com/skipkayhil/rails/railties/lib/rails/command.rb:149:in `with_argv' from /home/hartley/src/github.com/skipkayhil/rails/railties/lib/rails/command.rb:69:in `invoke' from /home/hartley/src/github.com/skipkayhil/rails/railties/lib/rails/commands.rb:18:in `<top (required)>' from bin/rails:4:in `require' from bin/rails:4:in `<main>' ``` This commit fixes the issue by checking first whether the Dockerfile exists before trying to perform any substitution on it. [1]: ac9f08d1c354baab6362d7050a3c9e43db09689c
2023-11-09 15:49:19 +00:00
*Hartley McGuire*
* In Action Mailer previews, list inline attachments separately from normal
attachments. For example, attachments that were previously listed like
> Attachments: logo.png file1.pdf file2.pdf
will now be listed like
> Attachments: file1.pdf file2.pdf (Inline: logo.png)
*Christian Schmidt* and *Jonathan Hefner*
* In mailer preview, only show SMTP-To if it differs from the union of To, Cc and Bcc.
*Christian Schmidt*
2024-01-16 19:39:04 +00:00
* Enable YJIT by default on new applications running Ruby 3.3+.
Adds a `config/initializers/enable_yjit.rb` initializer that enables YJIT
when running on Ruby 3.3+.
*Jean Boussier*
* In Action Mailer previews, show date from message `Date` header if present.
*Sampat Badhe*
* Exit with non-zero status when the migration generator fails.
*Katsuhiko YOSHIDA*
* Use numeric UID and GID in Dockerfile template
The Dockerfile generated by `rails new` sets the default user and group
2024-01-16 19:39:04 +00:00
by name instead of UID:GID. This can cause the following error in Kubernetes:
```
container has runAsNonRoot and image has non-numeric user (rails), cannot verify user is non-root
```
This change sets default user and group by their numeric values.
*Ivan Fedotov*
* Disallow invalid values for rails new options.
2024-01-16 19:39:04 +00:00
The `--database`, `--asset-pipeline`, `--css`, and `--javascript` options
for `rails new` take different arguments. This change validates them.
*Tony Drake*, *Akhil G Krishnan*, *Petrik de Heus*
2024-01-16 19:39:04 +00:00
* Conditionally print `$stdout` when invoking `run_generator`.
In an effort to improve the developer experience when debugging
generator tests, we add the ability to conditionally print `$stdout`
instead of capturing it.
This allows for calls to `binding.irb` and `puts` work as expected.
```sh
RAILS_LOG_TO_STDOUT=true ./bin/test test/generators/actions_test.rb
```
*Steve Polito*
2023-09-27 03:08:31 +00:00
* Remove the option `config.public_file_server.enabled` from the generators
for all environments, as the value is the same in all environments.
*Adrian Hirt*
Please check [7-1-stable](https://github.com/rails/rails/blob/7-1-stable/railties/CHANGELOG.md) for previous changes.