ruby - MongoMapper Embedded Documents -


I have products in the form of an embedded document inside the class below:

  'Mongo_mapper' category in the category: Mongomar :: Document key: Name, string key: Number of products, integer many: end of products  

and here is the product category:

  requires the MongoMapper :: EmbeddedDocument key in the 'Mongo_mapper' category product, name, string and  

The following code is used to display but it says that "name" requires 'rugbygums', 'mungo' is required 'demand_mapper' is required 'category' is required 'product' In which Mongo Mongomapramate = 'Northwind' category = category all () categories.each {| Category | Sets the square. Unless that category.Products.nil? Category.Products.each {| Products |

Here is an error:

  undefined method {"name" = 'gt;' 'Amiga'}: BSON :: hash ordered (noamthier entry)  

OK, the first thing to try is that you have:

  many: products  

... but then you can call it Certainly be consistent with your naming, and I do not have Ruby conventions (underscore, not secrete of camel, and of course, tissue cases for non-squares). In).

So, Maybe: Category: MongoMapper :: Document key: name, string: Many MongoMapper :: embedded document key in the end product of the product: name, string end categories = category. All categories. Category category.products.each does | Product | "Product + Name End End


Comments