我使用的Neo4j 2.0.1與3.2.1的軌道。我收到一個似乎很基本的錯誤,但我似乎無法解決它。我會很感激任何幫助!未定義_other_node未繳:NilClass錯誤的Neo4j與軌道
這裏是我的代碼片段:
rels1 = identity1.rels(:outgoing,:friends)
if !rels1.nil? and rels1.count > 0
friendships12 = rels1.to_other(identity2)
end
其中對identity1和identity2是Neo4j的:: Rails的子類::模型對象。
我得到的錯誤是上線「friendships12 = ....」和它說
"undefined method `_other_node' for nil:NilClass"
我在做什麼錯?起初,我嘗試了很明顯的:
friendships12 = identity1.rels(:outgoing,:friends).to_other(identity2)
這是基於軌道指南Neo4j的(http://neo4j.rubyforge.org/guides/basic.html,請參閱「兩個節點之間的關係尋找」)。但是,這給了我同樣的錯誤,這就是爲什麼我如上所述嘗試。但錯誤仍然存在。