Sha256: 0ff524fd648f1353b5e756d6dcfbeb5b4a3dce7c6e57000fbf5bf366fee390f8

Contents?: true

Size: 470 Bytes

Versions: 3

Compression:

Stored size: 470 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 = Arel::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

3 entries across 3 versions & 1 rubygems

Version Path
temporal_tables-0.8.1 lib/temporal_tables/arel_table.rb
temporal_tables-0.8.0 lib/temporal_tables/arel_table.rb
temporal_tables-0.7.1 lib/temporal_tables/arel_table.rb