Question: I have a restaurant that has\_many menus and a menu that has\_many sub\_menus. Am trying to get the total orders for each menu or sub\_menu within rails views. I already have the logic of splitting the two (menu and sub\_menu) through if, else statement. But am having trouble of having sum of all orders for each menu or sub\_menu. I have tried this

```
<% restaurant.menus.each do |menu| %>
    <%= menu.orders.map{|sum, order|sum+order %>
<% end %>

```

this throws an symbol '+' error while this gets count but not total

```
<%= restaurant.menus.orders.count %>

```

UPDATE

---

A restaurant has\_many menus (model Menu) while a menu has\_many sub\_menus (Model sub\_menu). Both menu and sub\_menu have many orders (model Order). So am trying to get count of orders a menu or sub\_menu has. Hope its quite clear.

Answer: 
press F12, check all the resources your browser displaying. You can find all the images link in the resource tab.
[1] Map data is overlaid server-side, then sent to client as images. E.g.: 

```
GET https://mt3.google.com/mapslt?lyrs=gw:direct:GFwQAlABWgZsbXE6Kip1wBWuQHoFZjphbnk|gid:XTlZKwxnPFg6qxnrb95r6g&x=5283&y=12716&z=15&hl=en

```

`mt3` server  

`mapslt` **???**  

`lyrs=gw` **???**  

`direct:...|gid:...` presumably specifies the ID of the image after it was overlaid with landmarks and red building polygons server-side.  

`x=[0, 2^z - 1] y=[0, 2^z - 1]` specifies tile coordinate  

`z=[0,21]` specifies zoom level (note that number of tiles is dependent on zoom level)  

`hl:en` english language 

[2] One must acquire calibrated images in which pixels can be mapped to lat/long. This may be performed, e.g., by specifying xyz coordinates (`lyrs=m@[\d]+` **???**):

```
http://mt0.google.com/vt/lyrs=m@129&hl=en&x=23&y=13&z=5

```

or using the [static maps API](https://developers.google.com/maps/documentation/staticmaps/). Finally, one can process the images for the desired objects (e.g. via color thresholding) and then determine the lat/long of the pixels through [Mercator projection](http://www.maptiler.org/google-maps-coordinates-tile-bounds-projection/).

---

**Please fill in ??? if you know.**