ruby - Mongoid: How to reference parent object attributes from a child in N-to-N relationship -


I'm totally new to the new definition of class, what is there to do with an option or something like that? Monogead in the class band :: Document Field: Name, Type: String is_and_belong_to_man: Members include the end class members of Mongaid :: Document Field: Name, Type: string__and_blog_to_mem: band and endy = Member.New (name: 'Andy Bell') Ride = Band.New (name: 'Ride') Ride. Members & lt; & Lt; Andy Oasis = Band.New (name: 'Oasis') Oasis Members & lt; & Lt; Andy Andy Band # = & gt; Returns: [] (empty array) andy.band_ids # = & gt; Returns: [BSON :: Object ID ('53586 A786D6163870C30000'), BSON :: ObjectID ('53586 A786D6163870 CT 40000')]

I'm not sure, but reading again using the method of loading, does it help?:

If you You are using a default scope on a model that has has_many, has_and_belongs_to_many, or embeds_many, you have to reoplied the relationship to be relocated. It is important to note that if you change the value of a document in relation to that it will affect its visibility within the scoped relationship.

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -