activegraph icon indicating copy to clipboard operation
activegraph copied to clipboard

ActiveNode inherit from a base class that is not a Node

Open am17torres opened this issue 4 years ago • 1 comments

Is there a way to have an ActiveNode inherit from a base class that is not Node?

Additional information which could be helpful if relevant to your issue:

Code example (inline, gist, or repo)

Example:

app/models/base.rb

class Base
  include OpenApi::DSL
end

app/models/resource.rb

class Resource < Base
  include Neo4j::ActiveNode
  include Neo4j::Timestamps
end

When I try this I get an error:

`rescue in build_association': undefined method `associations' for Base:Class (Class#parent) (NoMethodError)

Runtime information:

Neo4j database version: 3.5.14 Community Edition neo4j gem version: 9.6.1 neo4j-core gem version: 9.0.0

am17torres avatar Jan 14 '20 22:01 am17torres

@am17torres I totally agree with you. What you intend to do should be possible. Having said that I cannot imagine we will have the time to address that before we revisit the Label/Module vs. Label/Class concept. Right now it's impossible to express multiple labels on a node. But if you think there is a simple not too invasive fix to the problem you are more than welcome to create a PR against master. I'm sure your Base class is more complicated than in your example or otherwise, there would be no benefit of creating it and you could include the module directly.

klobuczek avatar Mar 04 '20 18:03 klobuczek