Skip to content

Expose Arel attributes through ActiveRecord::Table module and `t` method

Created by: flanger001

Summary

This implements a Table module and t class method for ActiveRecord models. The goal is to expose a table's Arel attributes without directly typing "Arel". This started with the [] method here: https://github.com/rails/rails/pull/39198

The module is installed after a db connection is available, and the methods are defined at call time:

Examples:

Developer::Table.id.eq(42)

Developer.t.salary.gt(9000)

References:

Merge request reports