【问题标题】:Update relationship properties in rails更新 Rails 中的关系属性
【发布时间】:2017-07-26 12:35:20
【问题描述】:

我正在使用Neo4j gem,只有ActiveNode。我可以创建关系属性,但如何访问和更新它?

我可以使用 Neo4j::ActiveBase.current_session.query('Cypher Query') 将整个内容编写为密码查询

但是不使用cypher怎么写呢?

【问题讨论】:

    标签: ruby-on-rails neo4j cypher


    【解决方案1】:

    如果您有一个 Person 模型与 friends 关联,您可以执行以下操作之一

    Person.friends.each_rel do |rel|
    end
    
    Person.friends.each_rel.map do |rel|
    end # or any other `Enumerable` method
    
    Person.friends.each_rel.to_a
    

    还有一个each_with_rel,它给出了节点和关系

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-06-01
      • 2022-01-11
      • 1970-01-01
      • 1970-01-01
      • 2018-11-07
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多