Class: AutoPreload::Adapters::ActiveRecord
- Inherits:
-
Object
- Object
- AutoPreload::Adapters::ActiveRecord
- Defined in:
- lib/auto_preload/adapters/active_record.rb
Overview
This class takes a model and finds all the preloadable associations.
Instance Method Summary collapse
-
#resolve_preloadables(model, _options = {}) ⇒ Array<ActiveRecord::Reflection>
The preloadable associations.
Instance Method Details
#resolve_preloadables(model, _options = {}) ⇒ Array<ActiveRecord::Reflection>
Returns The preloadable associations.
9 10 11 12 13 14 15 |
# File 'lib/auto_preload/adapters/active_record.rb', line 9 def resolve_preloadables(model, = {}) if model.auto_preloadable model.auto_preloadable.map { |w| model.reflect_on_association(w) }.compact else model.reflect_on_all_associations end end |