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)
I want to merge these two records like both type of places will be refrenced in :p
Any solution I was also trying to do that in neo4j.rb before going to cypher
I would really like to allow the
type
option ofhas_one
/has_many
to support an array of relationship types so that you could do something like:That's not possible yet, unfortunately, but you can get by for now this hack to create such as association:
Protip:
User.as(:c).where(uuid: f_ids)
could simply beUser.where(id: f_ids)