This Week in Rails

June 16, 2023

SSL Enforcement, new Postgres enum features, and changes to Rails.application.secrets

Hi, it’s zzak. We’re officially half-way through June, and we’ve got a shorter edition this week but let’s hop in.

Enable `force_ssl=true` in production by default
This PR affects newly generated apps to make SSL enforcement the default behavior in production mode, ensuring all access to the application occurs over SSL, with Strict-Transport-Security and use secure cookies.

Adding PG enum drop, rename, add value, rename value
Initially opened over a year ago, this PR has finally been merged and adds `rename_enum`, `rename_enum_value`, and `add_enum_value` support to the PostgreSQL adapter.

Fix setting inverses for composite primary key associations
This bug fix for models using the `inverse_of` option which caused the related record not to be saved when using composite primary keys.

Fix `destroy_all` for `has_many through:` associations that points to a CPK model
Another bug fix for composite primary keys was affecting `destroy_all` when using the `has_many through:` association that points to a model with composite primary key.

Store `secret_key_base` in `Rails.config` for local environments.
Since secrets have been deprecated in favor of credentials, this PR removes the last dependency for local environments by using `Rails.config.secret_key_base` instead of `Rails.application.secrets.secret_key_base`.

Deprecate calling `Rails.application.secrets`
With the last PR merged a deprecation warning will now show up when you call `Rails.application.secrets`, instead you should use `Rails.application.credentials`.

Use cache `:coder` option to specify `:message_pack`
This PR removes the unreleased `:message_pack` option from `config.active_support.cache_format_version` and instead provides a new `:coder` option to the `config.cache_store` flag.

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

Until next time!

About This Week in Rails

Your weekly inside scoop of interesting commits, pull requests and more from Rails.