This Week in Rails

May 21, 2022

Bugfixes, guides improvement and more!

Hi, this is Greg, bringing you the latest news from the Rails world.

Add ability to ignore tables by a regular expression for SQL schema dumps
It was already possible to ignore tables by a regexp for ruby schema dump, but from now on if you use a SQL based structure dump, you can do so to by configuring ActiveRecord::SchemaDumper.ignore_tables = [/^_/]

Add skip_nil: support to RedisCacheStore
This change allows RedisCacheStore to also accept a default value for skip_nil.

Support unbounded time ranges for PostgreSQL
This PR fixed an issue when passing unbounded ranges to PostgreSQL.

Fixes Active Storage proxy downloads of files over 5Mb in S3-like storages
Downloading files over 5Mb in proxy mode didn't work properly with Active Storage, but this PR fixes the issue. A detailed description of the issue and the fix is in the description.

Make validators accept lambdas without record argument
Now you can set validators without passing the object to the lambda like this: validates_comparison_of :birth_date, less_than_or_equal_to: -> { }

Fix using helpers in content_security_policy and permissions_policy
Helpers that are generated using helper_method were not possible to use in content_security_policy and permissions_policy, because the use of yield caused self to be set incorrectly. But by using instance_exec, this PR ensures the scoping is correct.

Add db_runtime to Active Job instrumentation
This PR adds db_runtime to the notification payload of a perform.active_job event. db_runtime tracks the total time taken by database queries while performing a job, which helps in understanding how a job's time is spent.

More details to several HTTP Security Headers in guides
Some improvements to the security related HTTP headers in the guides.

Introduce config.log_file_size
No more huge log files in development! This config variable is set to 100Mb in development and test environments and Rails will rotate your log file when reaches the limit. In production the limit is unlimited by default.

Since last week, 39 people contributed to Rails. As usual, there are too many changes to cover them all, but you can check out all of them here. Until next time!