Class: ActionView::CollectionRenderer::PreloadCollectionIterator
- Inherits:
-
SameCollectionIterator
- Object
- CollectionIterator
- SameCollectionIterator
- ActionView::CollectionRenderer::PreloadCollectionIterator
- Defined in:
- lib/action_view/renderer/collection_renderer.rb
Overview
:nodoc:
Instance Method Summary collapse
- #each_with_info ⇒ Object
- #from_collection(collection) ⇒ Object
-
#initialize(collection, path, variables, relation) ⇒ PreloadCollectionIterator
constructor
A new instance of PreloadCollectionIterator.
Methods inherited from CollectionIterator
Constructor Details
#initialize(collection, path, variables, relation) ⇒ PreloadCollectionIterator
Returns a new instance of PreloadCollectionIterator.
75 76 77 78 79 |
# File 'lib/action_view/renderer/collection_renderer.rb', line 75 def initialize(collection, path, variables, relation) super(collection, path, variables) relation.skip_preloading! unless relation.loaded? @relation = relation end |
Instance Method Details
#each_with_info ⇒ Object
85 86 87 88 89 |
# File 'lib/action_view/renderer/collection_renderer.rb', line 85 def each_with_info return super unless block_given? @relation.preload_associations(@collection) super end |
#from_collection(collection) ⇒ Object
81 82 83 |
# File 'lib/action_view/renderer/collection_renderer.rb', line 81 def from_collection(collection) self.class.new(collection, @path, @variables, @relation) end |