JSONAPI-Resources / JSONAPI-Resources/jsonapi-resources

Neo4j ORM Issues (non ActiveRecord)

Open
#796 5 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Ruby
Stars
2.3k
Forks
546
PR merge metrics
No merged PRs in 30d

Description

Hi. I'm working on a rails project using the Neo4j ORM which tries to mimic ActiveRecord, but doesn't use ActiveRecord. GET-ing things works fine, but as soon as I want to POST I get errors.

I've started using 0.8.0.beta1 to overcome the ActiveRecordOperationsProcessor issues fixed in #192, but have run into a new error uninitialized constant JSONAPI::ActsAsResourceController::ActiveRecord in ActsAsResourceController line 84

As I was writing this I just realised I can monkey patch with the following, but this probably isn't a good long term solution. It seems to be working with very minimal testing though.

module JSONAPI
  module ActsAsResourceController

    def transaction
      lambda { |&block|
        Neo4j::Transaction.run do |tx|
          block.yield
        end
      }
    end

    def rollback
      lambda {
        fail tx.mark_failed
      }
    end

  end
end

Does anyone have any advice on this situation? Is this an issue for other non ActiveRecord ORM's.

Thanks for your help.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at lib/jsonapi/acts_as_resource_controller.rb line 84 and inspect how transaction and rollback depend on ActiveRecord. Reproduce a POST using the Neo4j ORM, then compare the controller's transaction behavior with the monkey patch shown in the issue. Done means POST requests work without referencing an ActiveRecord constant.

Written by the indexing model from the issue text.

Assessment

Tech stack
neo4j, rails, ruby
Domain
api, backend, databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.