-
Notifications
You must be signed in to change notification settings - Fork 276
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[3.0] has_one association reader returns Hash instead of model object #440
Comments
Thanks. Yes there are limitations using transactions together with the Neo4j server. I will add this to the documentation. We can probably solve this if models uses |
Thanks for the suggestion. I will try use id_property |
id_property will not solve your problem, but maybe you can do a workaround using the id which is available in the hash response. Yes, this is very awkward and might not solve your problem. |
At least I can use the id to find back node and provide a wrapper to the association method, right? Something in my mind: alias :old_next :next
def next
record = old_next
Hash === record ? [find model by record's id property] : record
end Or are you saying it is not even possible to read the node back once in transaction? |
Sorry I accidentally close this. I guess you want to keep this issue open for 3.1.0 milestone. |
Hmm, looks the workaround I was thinking of was not working. Did a test and neo4j-core complained. I will investigate. class FooPerson
include Neo4j::ActiveNode
id_property :uuid, auto: :uuid
property :name
has_one :out, :next, model_class: self
end
def test
f1 = FooPerson.create name: 'f1'
f2 = FooPerson.create name: 'f2'
f1.next = f2
n = f1.next
id = n['uuid']
puts "F1 #{n.inspect} id #{id}"
nodes = Neo4j::Label.find_nodes(FooPerson.name, :uuid, id).to_a
puts "FOUND #{nodes.inspect}"
end
Neo4j::Transaction.run { test } |
…rver, fixed find by label method, neo4jrb/activegraph#440
Realize this one is pretty old but all issues related to working within transactions should be resolved as of 3.0.1. @wpc please let me know if you're still having any trouble. |
Found this on 3.0.0.alpha.11 with Cypher session type.
Hope this is helpful.
The text was updated successfully, but these errors were encountered: