mongoid/mongoid — Issue #1763: Includes (Eager Loading) and JSON
Author: meskyanichi
Created: 2012-02-27 00:56:02+00:00
State: open

Hi,

I'm trying to do some basic eager loading but I am unable to get it to work. I'm not sure whether I'm just doing it wrong or whether it's a bug. I'd think the former.

My database.yml

```yml
development:
host: localhost
database: webdv
pool_size: 5
identity_map_enabled: true
```

Then in rails console I try this:

```ruby
User.includes(:folders).to_json
```

The only thing it returns is an array of users, nothing else. Even when doing something like:

```ruby
User.includes(:folders).to_a
```

Still just returns an array of users, but no accounts (as far as I can see at least).

Tried it with the latest gem and also with the latest master branch (3.0.0). Can't seem to get it to work.

Any help much appreciated.