Friday, September 20, 2024

Kamal 2, Bye-bye Sprockets, and so much more!

Posted by zzak

Hi, it’s zzak. Let’s explore this week’s changes in the Rails codebase.

Rails World 2024 is next week
Safe travels to everyone heading to Toronto! All sessions will be recorded and published on the Rails YouTube channel, so subscribe to get notified.

[RF Guides] Active Record Validations
The Foundation is still hard at work on updating the guides, this time they have made a pass through the Active Record Validations guide. Give it a look and help them spot any issues!

Add ability to use multiple rate limits per controller
With this PR, you can now add multiple rate_limit definitions in your controller.

Remove Sucker Punch Active Job adapter
Sucker Punch existed before ActiveJob, but ultimately uses similar code to the async adapter under the covers. This adapter will be removed in a future release of Rails.

Do not include redis by default in dev container
In Rails 8, newly generated apps will use the Solid gems by default, which do not depend on Redis.

Add if_not_exists option to add_enum_value
This PR adds support to use the PostgreSQL option IF NOT EXISTS when adding enum values via add_enum_value.

Include options when instrumenting ActiveSupport::Cache::Store delete
Now cache_delete.active_support and cache_delete_multi.active_support events will include the options passed to the delete method.

No new apps should be started with sprockets
The --asset-pipeline flag will no longer take an argument for “propshaft” or “sprockets”, when generating a new Rails application.

Kamal 2 compatible configuration
Kamal 2 is bringing auto-SSL and multi-app deploys to the party. Along with other updates like simpler builders, aliases, and secrets.

Set “config.active_record.attributes_for_inspect” to “:all” in the console
In Rails 7.2, ActiveRecord::Core#inspect was made configurable but people noticed that the console in production was not showing any attributes. This PR sets the default to the previous behavior that was expected.

Support dropping multiple tables at once
This PR enables you to pass multiple names to the drop_table method.

Use thread pool for ActionController::Live
Exactly what it says on the tin, a thread pool is now used to reuse threads across requests.

Add Parameters#expect to safely filter and require params
This PR adds a new way to handle params giving more control over what you expect to receive in your controller actions.

# Before
params.require(:table).permit(:attr)

# After
params.expect(table: [ :attr ])

You can view the whole list of changes here. We had 37 contributors to the Rails codebase this past week!

Until next time!

Subscribe to get these updates mailed to you.