diff --git a/benchmarks/benchmark.rb b/benchmarks/benchmark.rb index 2de4a0b..f496227 100755 --- a/benchmarks/benchmark.rb +++ b/benchmarks/benchmark.rb @@ -60,6 +60,10 @@ ITERATIONS.times { first_foo.as_of(Time.now) } end + x.report('#timeline') do + ITERATIONS.times { first_foo.timeline } + end + x.report('TimeGate .merge') do ITERATIONS.times { Bar.merge(Bar.all) } end diff --git a/lib/chrono_model/time_machine/timeline.rb b/lib/chrono_model/time_machine/timeline.rb index baa65a9..f67c0d2 100644 --- a/lib/chrono_model/time_machine/timeline.rb +++ b/lib/chrono_model/time_machine/timeline.rb @@ -108,7 +108,7 @@ def timeline_associations_from(names) def quoted_history_fields @quoted_history_fields ||= begin - validity = "#{connection.quote_table_name(table_name)}.#{connection.quote_column_name('validity')}" + validity = "#{quoted_table_name}.#{connection.quote_column_name('validity')}" %w[lower upper].map! { |func| "#{func}(#{validity})" } end