Class: SmartCollection::Associations::SmartCollectionAssociation
- Inherits:
-
ActiveRecord::Associations::HasManyAssociation
- Object
- ActiveRecord::Associations::HasManyAssociation
- SmartCollection::Associations::SmartCollectionAssociation
- Defined in:
- lib/smart_collection/associations/smart_collection_association.rb
Defined Under Namespace
Classes: ScopeBuilder
Instance Method Summary collapse
- #association_scope ⇒ Object
- #cached_scope ⇒ Object
- #skip_statement_cache? ⇒ Boolean
- #uncached_scope ⇒ Object
Instance Method Details
#association_scope ⇒ Object
50 51 52 53 54 55 56 57 58 59 |
# File 'lib/smart_collection/associations/smart_collection_association.rb', line 50 def association_scope if cache_manager = reflection.[:smart_collection].cache_manager unless cache_manager.cache_exists? owner owner.update_cache end cached_scope else uncached_scope end end |
#cached_scope ⇒ Object
69 70 71 |
# File 'lib/smart_collection/associations/smart_collection_association.rb', line 69 def cached_scope reflection.[:smart_collection].cache_manager.read_scope owner end |
#skip_statement_cache? ⇒ Boolean
61 62 63 |
# File 'lib/smart_collection/associations/smart_collection_association.rb', line 61 def skip_statement_cache? true end |
#uncached_scope ⇒ Object
65 66 67 |
# File 'lib/smart_collection/associations/smart_collection_association.rb', line 65 def uncached_scope ScopeBuilder.new(owner.rule, reflection.klass).build end |