module OccamsRecord::EagerLoaders
Contains eager loaders for various kinds of associations.
Public Class Methods
fetch!(ref)
click to toggle source
Fetch the appropriate eager loader for the given association type.
# File lib/occams-record/eager_loaders/eager_loaders.rb, line 22 def self.fetch!(ref) case ref.macro when :belongs_to ref.polymorphic? ? PolymorphicBelongsTo : BelongsTo when :has_one HasOne when :has_many HasMany when :has_and_belongs_to_many Habtm else raise "Unsupported association type `#{macro}`" end end