nmerouze/machinist_mongo

I can't use associations with mongo_mapper

Opened this issue · 2 comments

I've created blueprint with Product and Item following these models

class Item
include MongoMapper::EmbeddedDocument
belongs_to :product
end

class Product
include MongoMapper::Document
many :items
end

And blueprints.rb

Item.blueprint do
product { Product.make }
quantity (1..10).to_a.shuffle.first.to_i
total 5 * quantity
end

I receive this error when tests running:

undefined method `each' for #Product:0x007f90324dde28

Maybe because embedded documents no have association resources?

OH WAIT!! This doesn't work only in my test environment. I tested in rails console and works fine :S