Friday, January 19, 2024

A class method to introspect delegated types, schema_dump configuration via DATABASE_URL, etc

Posted by Emmanuel Hayford

As the morning sun casts its gentle glow, I find myself aboard a train bound for Szklarska Poręba. I’m literally on Rails! I thought, what better setting to share the latest updates on Rails than while traversing these literal rails?

Define a class method to introspect valid delegatable types This PR introduces a <role>_types class method within ActiveRecord::DelegatedType to enable introspection of delegated types.

Make schema_dump, query_cache, replica & database_tasks configurable via DATABASE_URL Enable configurability for schema_dump, query_cache, replica, and database_tasks via DATABASE_URL. Previously, this functionality faced limitations due to boolean values being incorrectly interpreted as strings. For example, DATABASE_URL=postgres://localhost/foo?schema_dump=false now properly disables dumping the schema cache.

Fix IPAddr prefix information missing when writing to the cache This PR incorporates the IPAddr#prefix into the serialization process of an IPAddr when utilizing the ActiveSupport::MessagePack serializer. This modification ensures both backward and forward compatibility; existing payloads remain readable, and newer payloads are compatible with earlier versions of Rails.

Ensure only directories exist in Rails default load paths Safeguard Rails default load paths by enforcing the presence of only directories. In the past, certain files within the app directory caused contamination in the load paths. This commit rectifies the issue by eliminating files from the default load paths established by the Rails framework. As a result, only directories are now considered in the default settings for the following paths:

  • autoload_paths
  • autoload_once_paths
  • eager_load_paths
  • load_paths

We had 33 contributors to the Rails codebase this past week! Have a look here for an exhaustive list of all changes.

Take care, Emmanuel Hayford

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

Subscribe to get these updates mailed to you.