Class: GraphQL::Models::PromiseRelationConnection
- Inherits:
-
Relay::RelationConnection
- Object
- Relay::RelationConnection
- GraphQL::Models::PromiseRelationConnection
- Defined in:
- lib/graphql/models/promise_relation_connection.rb
Instance Method Summary collapse
Instance Method Details
#edges ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/graphql/models/promise_relation_connection.rb', line 5 def edges # Can't do any optimization if the request is asking for the last X items, since there's # no easy way to turn it into a generalized query. return super if last relation = sliced_nodes limit = [first, last, max_page_size].compact.min relation = relation.limit(limit) if first request = RelationLoadRequest.new(relation) request.load.then do |models| models.map { |m| GraphQL::Relay::Edge.new(m, self) } end end |