Sha256: 5eaa2937c20200c471ad1eaa2030ee10f6ce7d2c89ff4dca242143bed26d1c2c

Contents?: true

Size: 464 Bytes

Versions: 1

Compression:

Stored size: 464 Bytes

Contents

module TemporalTables
  # This is required for eager_load to work in Rails 6.0
  module ArelTable
    def create_join(to, constraint = nil, klass = Nodes::InnerJoin)
      join = super
      if at_value = Thread.current[:at_time]
        join = join.
          and(to[:eff_to].gteq(at_value)).
          and(to[:eff_from].lteq(at_value))
      end
      join
    end
  end
end

case Rails::VERSION::MAJOR
when 6
  Arel::Table.prepend TemporalTables::ArelTable
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
temporal_tables-0.7.0 lib/temporal_tables/arel_table.rb