Class: SmartCollection::Reflection::SmartCollectionReflection

Inherits:
ActiveRecord::Reflection::HasManyReflection
  • Object
show all
Defined in:
lib/smart_collection/reflection/smart_collection_reflection.rb

Instance Method Summary collapse

Instance Method Details

#association_classObject



4
5
6
# File 'lib/smart_collection/reflection/smart_collection_reflection.rb', line 4

def association_class
  Associations::SmartCollectionAssociation
end

#chainObject



14
15
16
17
# File 'lib/smart_collection/reflection/smart_collection_reflection.rb', line 14

def chain
  items_name = options[:smart_collection].items_name
  active_record.reflect_on_association("cached_#{items_name}".to_sym).chain
end

#check_eager_loadable!Object



8
9
10
11
12
# File 'lib/smart_collection/reflection/smart_collection_reflection.rb', line 8

def check_eager_loadable!
  unless options[:smart_collection].cache_manager.instance_of? SmartCollection::CacheManager::Table
    raise RuntimeError, 'eager_load is only supported when using table for cache.'
  end
end