Friday, December 8, 2023

Allow object_id as a column name for Active Record and a lot more!

Posted by Emmanuel Hayford

Take Active Record affixes into account for Active Storage database models This pull request ensures that all Active Storage database-related models adhere to the ActiveRecord::Base.table_name_prefix configuration.

Make isolated engines aware of Active Record::Base table name prefix Address isolated engines to incorporate the ActiveRecord::Base.table_name_prefix configuration. This adjustment will enable engine-defined models, including those within Active Storage, to align with the Active Record table name prefix configuration.

Alias field_set_tag helper to fieldset_tag Rename the field_set_tag helper to fieldset_tag for consistency with the <fieldset> HTML element.

Fix Time.now/DateTime.now/Date.today to return results in a system timezone after #travel_to Correct Time.now, DateTime.now, and Date.today to produce results in the system timezone after the use of #travel_to.

The current implementation of #travel_to has a bug wherein it retains the timezone of its argument, causing all stubbed methods to return results in that remembered timezone. The intended behavior, however, is to have these methods return results in the system timezone.

Preserve serialized timezone when deserializing with ActiveJob::Serializers::TimeWithZoneSerializer Retain the serialized timezone information when deserializing arguments of type ActiveSupport::TimeWithZone.

Allow object_id as a column name for Active Record This pull request now allows you to use object_id as a valid column name for Active Record.

Add a Active Record.protocol_adapters configuration to map DATABASE_URL protocols When utilizing a DATABASE_URL, introduce a configuration option to associate the protocol specified in the URL with a particular database adapter. This separation allows the application to select an adapter independently from the database connection details configured in the deployment environment.

# ENV['DATABASE_URL'] = "mysql://localhost/example_database"
config.active_record.protocol_adapters.mysql = "trilogy"
# will connect to MySQL using the trilogy adapter

That brings us to to the end of our weekly Rails codebase updates.

In the last two weeks, we saw 38 contributors grace Rails’ codebase.

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.