If you’re using reflection_on_association with ActiveRecord and need to use it with MongoMapper, here is what you want to do:
undefined method `reflect_on_association' for User:Class
ActiveRecord:
User.reflect_on_association(:posts).klass.new
MongoMapper:
User.associations[:posts].klass.new
Mongoid:
User.associations['posts'].klass.new
notice the posts is a string, it will not work with a symbol
UPDATE – (Apr 2011) Mongoid now follows ActiveRecord’s style naming:
User.reflect_on_association(:posts).klass.new