views:

30

answers:

0

I have a following association

Class Person 
    include Mongoid::Document
    embeds_many :employments
end

Class Employment
    include Mongoid::Document
    references_many :centres
end

class Centre
    include Mongoid::Document
    referenced_in :employment
end

Now when I tried

Person.first.employments.first.centres.build it gave me errors like

NoMethodError: undefined method `centres' for #<Employment:0x000001023f38f8>

Am i doing any thing wrong?

Or the embedded document cannot reference many other documents?