Module: ActiveManageable::Methods::Auxiliary::Includes

Extended by:
ActiveSupport::Concern
Defined in:
lib/active_manageable/methods/auxiliary/includes.rb

Instance Method Summary collapse

Instance Method Details

#default_includes(method: @current_method) ⇒ Object



61
62
63
64
65
# File 'lib/active_manageable/methods/auxiliary/includes.rb', line 61

def default_includes(method: @current_method)
  includes = defaults[:includes] || {}
  associations = includes.dig(method.try(:to_sym), :associations) || includes.dig(:all, :associations)
  associations.is_a?(Proc) ? instance_exec(&associations) : associations
end

#default_loading_method(method: @current_method) ⇒ Object



67
68
69
70
71
# File 'lib/active_manageable/methods/auxiliary/includes.rb', line 67

def default_loading_method(method: @current_method)
  includes = defaults[:includes] || {}
  loading_method = includes.dig(method.try(:to_sym), :loading_method) || includes.dig(:all, :loading_method)
  loading_method || ActiveManageable.configuration.default_loading_method
end