Module: Themis::AR::AssociationExtension

Extended by:
ActiveSupport::Concern
Defined in:
lib/themis/ar/association_extension.rb

Overview

Extends ActiveRecord::Associations::Association Hooks load_target method with to process after_association_loaded callback.

Instance Method Summary collapse

Instance Method Details

#load_target_with_after_association_loaded(*args, &block) ⇒ Object

Run original load_target method and process after_association_loaded callback.



10
11
12
13
14
15
16
17
18
# File 'lib/themis/ar/association_extension.rb', line 10

def load_target_with_after_association_loaded(*args, &block)
  result = load_target_without_after_association_loaded(*args, &block)

  if callback = self.owner._after_association_loaded_callbacks[self.reflection.name]
    callback.call(self)
  end

  result
end