Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mongo mapper associations #45

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

kelsin
Copy link

@kelsin kelsin commented Jun 23, 2011

Howdy, at my company we wanted to be able to view embedded documents easier so i coded this up for us.

This provides two new options which (in my branch) are setup to false by default. No behavior changes occur in that situation.

If you set :mongo_mapper => { :show_associations => true } then you can see basic association information for the class and instance of mongo mapper documents. It will show up like:

"child" => embeds one Child,
"siblings" => many Sibling

If you also set :mongo_mapper => { :inline_embedded => true } than awesome_print will fully display embedded docs along with the parent like so:

"child" => embedded #<Child:0x00000> {
    blah...
}

Tests are included and the second commit was some more stub_dotfile! lines I had to add to get the tests to pass (since I had a .aprc with some indent settings).

I realize also that the mongo mapper support is very different in the development branch and wouldn't mind adding support there but it wasn't a priority right away. Also if you are not interested in having these options and support in awesome_print to begin with it wouldn't be worth doing the work right now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant