JSONAPI-Resources / JSONAPI-Resources/jsonapi-resources

Neo4j ORM Issues (non ActiveRecord)

未关闭
#796 5 条评论 3 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

主要语言
Ruby
星标
2.3k
派生
546
PR 合并指标
30 天内没有已合并 PR

描述

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.

贡献指南

这个仓库没有索引到贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从 lib/jsonapi/acts_as_resource_controller.rb 第 84 行开始,检查 transaction 和 rollback phụ thuộc vào ActiveRecord như thế nào。使用 Neo4j ORM 重现一个 POST,然后将 controller 的 transaction 行为与 issue 中所示的 monkey patch 进行比较。在不引用 ActiveRecord 常量的情况下 POST 请求能够正常工作,即表示完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
neo4j, rails, ruby
领域
api, backend, databases
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
需要澄清
新手友好度
25/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。