Module: ChronoModel::Patches::Preloader

Defined in:
lib/chrono_model/patches/preloader.rb

Overview

Patches ActiveRecord::Associations::Preloader to add support for temporal associations. This is tying itself to Rails internals and it is ugly :-(.

Defined Under Namespace

Modules: Association, ThroughAssociation

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#chronomodel_optionsObject (readonly)

Returns the value of attribute chronomodel_options.



10
11
12
# File 'lib/chrono_model/patches/preloader.rb', line 10

def chronomodel_options
  @chronomodel_options
end

Instance Method Details

#initialize(**options) ⇒ Object

Overwrite the initializer to set Chronomodel as_of_time and model options.



15
16
17
18
19
20
# File 'lib/chrono_model/patches/preloader.rb', line 15

def initialize(**options)
  @chronomodel_options = options.extract!(:as_of_time, :model)
  options[:scope] = chronomodel_scope(options[:scope]) if options.key?(:scope)

  super
end