Sunday, August 8, 2021

Active Record goodies and more!

Posted by gregmolnar

Hi there, this is Greg, bringing you the latest new about the Rails framework.

Allow entirely opting out of deprecation warnings

Previously if you set app.config.active_support.deprecation = :silence, some work would still be done on each call to ActiveSupport::Deprecation.warn, which had computing cost, but from now on, you can disable it completely.

Output Action Cable Javascript without transpiling and as ESM

This PR updates all the Rails Javascript to target ES2017 and ESM, as far as is possible. This makes it easier to use these outputs directly in browsers without bundling, yet still use ESM module.

Create database via UI when ActiveRecord::NoDatabaseError

This PR adds the possibility to create the database via the UI when database has not been created in development mode.

Add ActiveRecord::QueryMethods#in_order_of

#in_order_of allows you to specify an explicit order that you’d like records returned in based on a SQL expression, for instance: Post.in_order_of(:id, [3, 5, 1])

Add ActiveRecord::Relation#structurally_compatible?

#structurally_compatible? can be used to check if the relation that you are about to use for #or or #and is structurally compatible with the receiver.

20 people contributed to Rails since last time. All the changes can be checked here. Until next week!