Class: ApiPresenter::Resolvers::IncludedCollectionsResolver
- Defined in:
- lib/api_presenter/resolvers/included_collections_resolver.rb
Overview
Handles loading of associated collections and policies, or counts, for the given collection or single record.
Instance Attribute Summary collapse
-
#resolved_collections ⇒ Object
readonly
Returns the value of attribute resolved_collections.
Attributes inherited from Base
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(presenter) ⇒ IncludedCollectionsResolver
constructor
A new instance of IncludedCollectionsResolver.
Constructor Details
#initialize(presenter) ⇒ IncludedCollectionsResolver
Returns a new instance of IncludedCollectionsResolver.
12 13 14 15 |
# File 'lib/api_presenter/resolvers/included_collections_resolver.rb', line 12 def initialize(presenter) super(presenter) preload if relation.is_a?(ActiveRecord::Relation) && resolved_associations_map.any? end |
Instance Attribute Details
#resolved_collections ⇒ Object (readonly)
Returns the value of attribute resolved_collections.
7 8 9 |
# File 'lib/api_presenter/resolvers/included_collections_resolver.rb', line 7 def resolved_collections @resolved_collections end |
Instance Method Details
#call ⇒ Object
17 18 19 20 |
# File 'lib/api_presenter/resolvers/included_collections_resolver.rb', line 17 def call resolve_collections self end |