andreasronge/neo4j — Issue #102: Inheritance for Neo4j::Rails::Model does not work in Rails
Author: dnagir
Created: 2011-12-14 23:15:54+00:00
State: open

Setting a relationship on a model that inherits from another model
causes an exception.
For example:

```ruby
class BizProcess < Neo4j::Rails::Model
property :title, :type => String
end

class Innovation < BizProcess
has_n(:deps).to(Department)
end

class Department < Neo4j::Rails::Model
property :name, :type => String
index :name
has_n(:innovations).from(Innovation, :deps)
end
```

Then when typing 'Innovation' in rails console:

```
Innovation
LoadError: Expected /app/models/innovation.rb to define Innovation
```

In the stack trace down the line it points to the issue being the line
in the Department model that defines the relationship.
When setting Innovation to inherit from Neo4j::Rails::Model, the
problem goes away, but that's not an acceptable solution.
One workaround I've used it defining it in the BizProcess model, but
this is confusing to others.

See http://groups.google.com/group/neo4jrb/browse_thread/thread/8de92e30e94f34ea

http://neo4j.lighthouseapp.com/projects/15548/tickets/184-inheritance-for-neo4jrailsmodel-does-not-work-in-rails