jnunemaker/mongomapper — comment on commit e755e1aab0257e575e46777ceab13ea4619cf905
File:  line 0
By digitalplaywright:

@brianhempel: Thanks. :class_name is what I want for number 1, and I agree that official documentation of this feature would be very useful. This is actually similar to the way we currently implement this using Mongoid (see example in gist below).

@bkeepers @brianhempel: Since my examples did not reflect the @bkeepers :inverse_of syntax I've created an updated gist that takes your comments into account. In the updated gist :class_name is used to specify the class and :inverse_of to specify the inverse association:
https://gist.github.com/1535744

I believe :inverse_of and :class_name can be inferred in the trivial case where the field name equals the class or collection name.

In case it is useful I've added a new gist with the examples in Mongoid syntax. Number one could be done with polymorphic embedded relations if a bug was fixed in Mongoid.
https://gist.github.com/1535543

Please let me know if this syntax makes sense.