Sha256: d3713949dfcc62ff85b1a951211cd2604d76d8495429f8235b43e14236b3d676

Contents?: true

Size: 580 Bytes

Versions: 4

Compression:

Stored size: 580 Bytes

Contents

module TemporalTables
  # This is required for eager_load to work in Rails 5.0.x
  module JoinDependencyExtensions
    def build_constraint(klass, table, key, foreign_table, foreign_key)
      constraint = super
      if at_value = Thread.current[:at_time]
        constraint = constraint.and(klass.build_temporal_constraint(at_value))
      end
      constraint
    end
  end
end

case Rails::VERSION::MAJOR
when 5
  case Rails::VERSION::MINOR
  when 0, 1
    ActiveRecord::Associations::JoinDependency::JoinAssociation.prepend TemporalTables::JoinDependencyExtensions
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
temporal_tables-0.8.1 lib/temporal_tables/join_extensions.rb
temporal_tables-0.8.0 lib/temporal_tables/join_extensions.rb
temporal_tables-0.7.1 lib/temporal_tables/join_extensions.rb
temporal_tables-0.7.0 lib/temporal_tables/join_extensions.rb