Что касается вашего другого решения, я не слишком хорошо знаком с методом rels
(и, похоже, не могу его найти), но я предполагаю, что он возвращает объекты CypherRelationship
или ActiveRel
. На самом деле я немного удивлен, что это работает, только если вы определяете ActiveRel
модели, потому что он должен возвращать CypherRelationship
объектов, если они не определены.
Однако я предполагаю, что ваша проблема заключается в том, что вам, вероятно, нужно использовать start_node
и end_node
вместо from_node
и to_node
. Вероятно, нам следует стандартизировать это...
РЕДАКТИРОВАТЬ: я редактирую это, чтобы добавить Neo4j::Server::CypherRelationship, который возвращается, когда он не является ActiveRel. нет ни start_node, ни from node :
{
"session": {
"connection": {
"parallel_manager": null,
"headers": {
"Content-Type": "application/json",
"User-Agent": "neo4j-gem/4.1.2 (https://github.com/neo4jrb/neo4j)",
"Authorization": "Basic realm=\"Neo4j\" OjdhYTUxNTcyYzBmMzBkYTMyNmY0NWQwMDc4ZTRlY2Rk"
},
"params": {},
"options": {
"params_encoder": null,
"proxy": null,
"bind": null,
"timeout": null,
"open_timeout": null,
"boundary": null,
"oauth": null
},
"ssl": {
"verify": null,
"ca_file": null,
"ca_path": null,
"verify_mode": null,
"cert_store": null,
"client_cert": null,
"client_key": null,
"certificate": null,
"private_key": null,
"verify_depth": null,
"version": null
},
"default_parallel_manager": null,
"builder": {
"handlers": [
{
"name": "Faraday::Request::BasicAuthentication",
"args": [
"neo4j",
"hroads"
],
"block": null
},
{
"name": "FaradayMiddleware::EncodeJson",
"args": [],
"block": null
},
{
"name": "FaradayMiddleware::ParseJson",
"args": [
{
"content_type": "application/json"
}
],
"block": null
},
{
"name": "Faraday::Adapter::NetHttpPersistent",
"args": [],
"block": null
}
],
"app": {
"header_value": "Basic bmVvNGo6aHJvYWRz",
"app": {
"app": {
"app": {
"app": {}
},
"options": {
"content_type": "application/json"
},
"content_types": [
"application/json"
]
}
}
}
},
"url_prefix": {
"scheme": "http",
"user": null,
"password": null,
"host": null,
"port": 80,
"path": "/",
"query": null,
"opaque": null,
"registry": null,
"fragment": null,
"parser": null
},
"proxy": null
},
"auth": {
"url": "http://localhost:7474",
"connection": {
"parallel_manager": null,
"headers": {
"Content-Type": "application/json",
"User-Agent": "neo4j-gem/4.1.2 (https://github.com/neo4jrb/neo4j)",
"Authorization": "Basic realm=\"Neo4j\" OjdhYTUxNTcyYzBmMzBkYTMyNmY0NWQwMDc4ZTRlY2Rk"
},
"params": {},
"options": {
"params_encoder": null,
"proxy": null,
"bind": null,
"timeout": null,
"open_timeout": null,
"boundary": null,
"oauth": null
},
"ssl": {
"verify": null,
"ca_file": null,
"ca_path": null,
"verify_mode": null,
"cert_store": null,
"client_cert": null,
"client_key": null,
"certificate": null,
"private_key": null,
"verify_depth": null,
"version": null
},
"default_parallel_manager": null,
"builder": {
"handlers": [
{
"name": "Faraday::Request::BasicAuthentication",
"args": [
"neo4j",
"hroads"
],
"block": null
},
{
"name": "FaradayMiddleware::EncodeJson",
"args": [],
"block": null
},
{
"name": "FaradayMiddleware::ParseJson",
"args": [
{
"content_type": "application/json"
}
],
"block": null
},
{
"name": "Faraday::Adapter::NetHttpPersistent",
"args": [],
"block": null
}
],
"app": {
"header_value": "Basic bmVvNGo6aHJvYWRz",
"app": {
"app": {
"app": {
"app": {}
},
"options": {
"content_type": "application/json"
},
"content_types": [
"application/json"
]
}
}
}
},
"url_prefix": {
"scheme": "http",
"user": null,
"password": null,
"host": null,
"port": 80,
"path": "/",
"query": null,
"opaque": null,
"registry": null,
"fragment": null,
"parser": null
},
"proxy": null
},
"params": {
"basic_auth": {
"username": "neo4j",
"password": "hroads"
}
},
"token": "7aa51572c0f30da326f45d0078e4ecdd"
},
"resource_url": "http://localhost:7474/db/data/",
"resource_data": {
"extensions": {},
"node": "http://localhost:7474/db/data/node",
"node_index": "http://localhost:7474/db/data/index/node",
"relationship_index": "http://localhost:7474/db/data/index/relationship",
"extensions_info": "http://localhost:7474/db/data/ext",
"relationship_types": "http://localhost:7474/db/data/relationship/types",
"batch": "http://localhost:7474/db/data/batch",
"cypher": "http://localhost:7474/db/data/cypher",
"indexes": "http://localhost:7474/db/data/schema/index",
"constraints": "http://localhost:7474/db/data/schema/constraint",
"transaction": "http://localhost:7474/db/data/transaction",
"node_labels": "http://localhost:7474/db/data/labels",
"neo4j_version": "2.2.0-M02"
}
},
"response_hash": {
"extensions": {},
"metadata": {
"id": 2000,
"type": "LEAD_TO"
},
"data": {
"created_at": 1422832907
},
"property": "http://localhost:7474/db/data/relationship/2000/properties/{key}",
"start": "http://localhost:7474/db/data/node/1266",
"self": "http://localhost:7474/db/data/relationship/2000",
"end": "http://localhost:7474/db/data/node/1264",
"type": "LEAD_TO",
"properties": "http://localhost:7474/db/data/relationship/2000/properties",
"id": 2000
},
"rel_type": "LEAD_TO",
"props": {
"created_at": 1422832907
},
"start_node_neo_id": 1266,
"end_node_neo_id": 1264,
"id": 2000
}
person
Brian Underwood
schedule
02.02.2015