andreasronge/neo4j — Issue #127: to_json(:include => ...) not working
Author: declan
Created: 2012-01-13 00:31:14+00:00
State: open

When two model are connected with a has_n relationship, then it seems that `to_json` does not include the associated models, even if the :include option is passed.

```ruby
class Actor < Neo4j::Model
property :name
has_n(:roles).to(Movie)
end

class Movie < Neo4j::Model
property :title
has_n(:actors).from(Actor, :roles)
end

a = Actor.create(:name => 'Clark Gable')
a.roles.create(:title => 'Gone With the Wind')

a.roles.count # => 1
a.to_json # => {"actor":{"name":"Clark Gable"}}

# Ok, so that's all good. But this next line isn't.
a.to_json(:include => :roles) # => {"actor":{"name":"Clark Gable"}}
# ... should also include movies.
```