Module: Core::Io::Base::EagerLoadingBehaviour

Included in:
Core::Io::Base
Defined in:
app/api/core/io/base/eager_loading_behaviour.rb

Instance Method Summary collapse

Instance Method Details

#eager_loading_for(model) ⇒ Object


10
11
12
# File 'app/api/core/io/base/eager_loading_behaviour.rb', line 10

def eager_loading_for(model)
  model or raise StandardError, 'nil model does not make sense here at all!'
end

#set_eager_loadingObject


2
3
4
5
6
7
8
# File 'app/api/core/io/base/eager_loading_behaviour.rb', line 2

def set_eager_loading
  singleton_class.class_eval do
    define_method(:eager_loading_for) do |loaded_class|
      yield(super(loaded_class))
    end
  end
end