Class: GraphQL::Relay::RelationConnection

Inherits:
BaseConnection show all
Defined in:
lib/graphql/relay/relation_connection.rb

Constant Summary collapse

DEFAULT_ORDER =
"id"

Constants inherited from BaseConnection

BaseConnection::CONNECTION_IMPLEMENTATIONS, BaseConnection::CURSOR_SEPARATOR, BaseConnection::METHODS_FROM_ARGUMENTS

Instance Attribute Summary

Attributes inherited from BaseConnection

#arguments, #object

Instance Method Summary collapse

Methods inherited from BaseConnection

#after, #before, connection_for_items, create_type, #edges, #first, #has_next_page, #has_previous_page, #initialize, #last, #page_info, register_connection_implementation

Constructor Details

This class inherits a constructor from GraphQL::Relay::BaseConnection

Instance Method Details

#cursor_from_node(item) ⇒ Object



6
7
8
9
10
# File 'lib/graphql/relay/relation_connection.rb', line 6

def cursor_from_node(item)
  order_value = item.public_send(order_name)
  cursor_parts = [order, order_value]
  Base64.strict_encode64(cursor_parts.join(CURSOR_SEPARATOR))
end

#orderObject



12
13
14
# File 'lib/graphql/relay/relation_connection.rb', line 12

def order
  @order ||= (super || DEFAULT_ORDER)
end