简体   繁体   中英

API pagination with Rails and Neo4j

I'm using Rails and Neo4j.rb to build a REST API and I need to paginate some responses. First of all, I tried with neo4j-will_paginate gem but I got the following error when I executed bundle install :

Bundler could not find compatible versions for gem "activesupport":
  In Gemfile:
    neo4j-will_paginate (>= 0) ruby depends on
      activesupport (~> 3.0) ruby

    devise-neo4j (~> 2.0.0.alpha.1) ruby depends on
      neo4j (>= 3.0.0.alpha.6) ruby depends on
        activesupport (4.0.0)

Bundler could not find compatible versions for gem "neo4j":
  In Gemfile:
    neo4j (~> 3.0.0) ruby

    devise-neo4j (~> 2.0.0.alpha.1) ruby depends on
      neo4j (3.0.0.alpha.6)

How I can fix it without removing one of the dependencies?

Besides that, what's the proper way to include pagination: headers or rendered in JSON? Taking into account that I'm going to consume the response in a Ember app, what approach fits better?

Best regards!

First I think you should use the 3.0.x version of the gem (not the release candidate) as it's been out of rc for a while and there are a number of patches that have been applied.

Secondly, we made a separate neo4j-will_paginate gem because we weren't able to get access to the original on rubygems:

https://github.com/neo4jrb/neo4j-will_paginate_redux

That might help

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM