Module: Timescaledb::CounterCache::ClassMethods

Defined in:
lib/timescaledb/counter_cache.rb

Instance Method Summary collapse

Instance Method Details

#belongs_to_with_counter_cache(name, scope = nil, **options) ⇒ Object



10
11
12
13
14
15
16
17
# File 'lib/timescaledb/counter_cache.rb', line 10

def belongs_to_with_counter_cache(name, scope = nil, **options)
  if options[:counter_cache] == :timescaledb || options[:counter_cache].is_a?(Array)
    setup_timescaledb_counter_cache(name, options)
    options.delete(:counter_cache)
  end
  
  belongs_to(name, scope, **options)
end