I want to run directly Cypher queries in rails don't want to use ORM style because I have long queries which I made on neo4j console and when I am trying to change into orm style its not behaving as expected
MATCH (n {name: 'MU1'})-[:connected_to*1..2 {status: 1}]->(sp:User),
(sp)<-[:owner_of|house_mate]-(place:Place)-[:owner_of|house_mate]->(c:User)
WHERE NOT (n)-[:house_mate]-(place)
MATCH
(place)-[tenant:owner_of|house_mate]->(u:User)
WITH DISTINCT place, type(tenant) AS type, u
WITH place, collect({type: type, u: u}) AS tenants
RETURN
place,
[tenant IN tenants WHERE tenant.type = 'owner_of' | [tenant.u]][0] AS owner,
[tenant IN tenants WHERE tenant.type = 'house_mate' | [tenant.u]] AS houseMatesArray
Neo4j.query and Neo4j._query etc
Any Help?
Edit: How to write it in ORM style may be I was doing something wrong?