lib/neo4j/paginated.rb in neo4j-3.0.4 vs lib/neo4j/paginated.rb in neo4j-4.0.0.rc.1
- old
+ new
@@ -6,10 +6,10 @@
def initialize(items, total, current_page)
@items, @total, @current_page = items, total, current_page
end
def self.create_from(source, page, per_page, order = nil)
- target = source.node_var
+ target = source.node_var || source.identity
partial = source.skip((page - 1) * per_page).limit(per_page)
ordered_partial, ordered_source = if order
[partial.order_by(order), source.query.with("#{target} as #{target}").pluck("COUNT(#{target})").first]
else
[partial, source.count]
\ No newline at end of file