【发布时间】:2016-12-23 19:25:00
【问题描述】:
class User
include Neo4j::ActiveNode
has_many :in, :homes, origin: :owner
has_many :in, :shared_homes, origin: :home_mates, model_class: 'Home'
end
class Home
include Neo4j::ActiveNode
has_many :out, :housemates, type: :home_mate, model_class: 'User'
has_one :out, :owner, type: :owner_of, model_class: 'User'
end
# f_ids is array of users
@users = User.as(:c).where(uuid: f_ids)
# for homes
@homes = @users.homes(:p)
# for shared homes
@homes = @users.shared_homes(:p)
我想合并这两个记录,就像这两种类型的地方都会被引用:p
在使用 cypher 之前,我也在 neo4j.rb 中尝试过的任何解决方案
【问题讨论】: