I was able to do a specific pattern match from this original question Neo4j gem - Preferred method to deal with admin relationship via this
Event.query_as(:event).match("(event)<-[invite:invited]-(user1:User)<-[friends_with:friends_with]-(user2:User)").where('invite.admin = true').pluck(:event)
I was unable to get a modified version such as this to work
current_user.friends.events.query_as(:event).match("(event)<-[invite:invited]-(user:User)").where(invite: {admin: true}).pluck(:event)
So what I actually changed was I changed the direction for the from_node
and to_node
in my invite class
from_class User
to_class Event
type 'invited'
It was previously set as from Event
to User
. One of my questions is, why did I have to change that to make the query work? Doesn't the has_many: both
mean that direction doesn't matter?
Another change was changing my relationship type to lower case. In my model it is written in all lowercase which does seem to matter. I thought both would be converted to all uppercase like the way neo4j does it but as it stands right now, it doesn't.
I do think I need to get the current_user method working as I only want the events of the current_user's friends. Suggestions?