与Rails和Neo4j的API分页

时间:2014-12-14 20:39:17

标签: ruby-on-rails ruby ember.js neo4j neo4j.rb

我使用Rails和Neo4j.rb构建REST API,我需要对一些响应进行分页。首先,我尝试使用neo4j-will_paginate gem,但是当我执行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)

如何在不删除其中一个依赖项的情况下修复它?

除此之外,包含分页的正确方法是什么:标题或以JSON格式呈现?考虑到我将在Ember应用程序中使用响应,哪种方法更适合?

祝你好运!

1 个答案:

答案 0 :(得分:2)

首先,我认为你应该使用3.0.x版本的gem(不是候选版本)因为它已经退出rc一段时间了,并且已经应用​​了许多补丁。

其次,我们制作了一个单独的neo4j-will_paginate gem,因为我们无法访问rubygems上的原始文件:

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

这可能会有所帮助