【发布时间】:2019-02-18 20:52:39
【问题描述】:
Neo4j 和 Ruby 入门
https://neo4j.com/developer/ruby-course/
我遵循了这个指示。
rails new asset_portal -m http://neo4jrb.io/neo4j/neo4j.rb -O
cd asset_portal
rake neo4j:install[community-latest]
rake neo4j:start
我完成了项目设置并启动了 neo4j 服务器。
然后我按照说明为用户、资产、类别和书籍创建脚手架。
按照指示。
我也按照指示进行了更改。
现在我运行迁移,并启动服务器。
rake neo4j:migrate
rails s
open http://localhost:3000/books
我收到迁移错误
Neo4j::DeprecatedSchemaDefinitionError in Books#index
Some schema elements were defined by the model (which is no longer supported), but they do not exist in the database. Run the following to create them if you haven't already:
rake neo4j:generate_schema_migration[constraint,Book,isbn]
And then run `rake neo4j:migrate`
我按照说明运行了
rake neo4j:generate_schema_migration[constraint,Book,isbn]
rake neo4j:migrate
我仍然遇到同样的错误。
我发现了一个涉及相同错误的 neo4j git 链接,https://github.com/neo4jrb/neo4j/issues/1356。它说“id_property”是问题的根源。但我无法从这个帖子中得到明确的答案。
我正在按照 Neo4j 手册中的说明将书籍模型更改为
id_property :isbn
其他人必须已经遇到这个错误并解决了这个问题。 (也许 Neo4j 手册现在已经过时了)。请帮忙。
我在 Mac 上运行它。在我开始这个项目之前,我刚刚在我的 Mac 上更新了 rake、ruby。
$ rails --version
Rails 5.2.2
$ ruby --version
ruby 2.6.1p33 (2019-01-30 revision 66950) [x86_64-darwin17]
【问题讨论】:
标签: ruby-on-rails neo4j