Search code examples
ruby-on-railsneo4jrspec-railsneo4j.rb

Record Persistence in Neo4j.rb 8.0.x


I am in the process of upgrading to Neo4j.rb version 8. After following the instructions in the upgrade guide, specs that were passing before are now failing.

Specifically, count, persisted?, all, last and find seem to have come unhinged from each other. I can create an account, see that is is persisted, see it if I count accounts, but not if I look for the last account, or all accounts, or try to find it from its id.

Output from console session below. Am I crazy?

[1] pry> account = Account.create(company_name: "Acme Corporation, LLC", street_address: "1234 Fake Lane", city: "Pleasantville", state: "CA", zip: "12345", country: "United States", phone: "555-555-5555", contact_name: "Some Guy", contact_phone: "123-456-7890", contact_email: "[email protected]")

=> #<Account uuid: "30c44118-ac45-4559-b63b-8e82fafb16cd", city: "Pleasantville", company_name: "Acme Corporation, LLC", contact_email: "[email protected]", contact_name: "Some Guy", contact_phone: "123-456-7890", country: "United States", created_at: Thu, 23 Mar 2017 19:13:52 +0000, phone: "555-555-5555", remote_id: nil, state: "CA", street_address: "1234 Fake Lane", updated_at: Thu, 23 Mar 2017 19:13:52 +0000, zip: "12345">

[2] pry> account.persisted? => true

[3] pry> Account.count => 1

[4] pry> Account.last => nil

[5] pry> Account.find(account.id) Neo4j::ActiveNode::Labels::RecordNotFound: Couldn't find Account with 'uuid'=30c44118-ac45-4559-b63b-8e82fafb16cd


Solution

  • And the answer is....... RESTART YOUR COMPUTER AND EVERYTHING WORKS!!!111

    In reality the problem was that somewhere along the line I deleted the database rather than stopping it, and then installed a new copy.