kriysna
kriysna

Reputation: 6168

Mongoid with Machinist

I am using machinist and mongoid. How can I generate blueprint for embeds_many association. Mongoid embeds_many association embeds the hash of array. So I just started like this:

 User.blueprint do
   address { :address1 => "address", :address2 => 'next address'}
 end

Any Ideas?

Upvotes: 1

Views: 645

Answers (2)

kriysna
kriysna

Reputation: 6168

I Just tried in this way and worked

User.blueprint do   
 addresses {Address.make} 
end

Upvotes: 2

Matta
Matta

Reputation: 26

How about this?

User.blueprint do
   address { [{:address1 => "address"} , {:address2 => 'next address'}]}
end

Upvotes: 0

Related Questions