Hello, being a very early beginner I want to build my first little rails app. I want to show the users (my co-workers) the menu table of our catering service. We can choose between five different dishes, some salads and desserts every day. Looking through all the (quite good) tutorials on the Internet I could not find a similar task - meaning a similar data structure. Is there anybody who can give me an idea for the data model I shoud use. I don't have any experience with Rails that makes me find a proper solution. Is there a way to define "Menu[1..n], Salad [1..m], Dessert [1..i] for each day in an elegant way?
on 2008-12-28 18:18
on 2008-12-28 18:42
On Sun, Dec 28, 2008 at 8:08 AM, cgommel <firstname.lastname@example.org> wrote: > > Looking through all the (quite good) tutorials on the Internet I could > not find a similar task - meaning a similar data structure. > > Is there anybody who can give me an idea for the data model I shoud > use. > > I don't have any experience with Rails that makes me find a proper > solution. Is there a way to define "Menu[1..n], Salad [1..m], Dessert > [1..i] for each day in an elegant way? Hi there, Honestly, one of the best ways for you to map out your data model is to break down each element in your menu (assuming you have an existing physical one) to get a clear picture. What does a Menu consist of? What does a Menu Item consist? Are there different types of menu items? Does each menu item have a name, description, and price? Perhaps I helped you out a bit there, but that's really the best place to start. Don't think about the technical relationships until you answer those types of questions. While doing it, you'll see that your data model will evolve organically. Another tip, start with the easiest thing to model, which my guess would be the Menu itself (sans-menu items). You can have an empty Menu with your catering business information to start (name of business, address, etc..). Then think about what needs to go inside of it and begin to evolve your data model over time. This is also how you might consider developing the application. Build it in small pieces and evolve it as you go. This is one of the things that Rails encourages you to do. Keep it simple! Cheers, Robby -- Robby R. Chief Evangelist, Partner PLANET ARGON, LLC design // development // hosting w/Ruby on Rails http://www.planetargon.com/ http://www.robbyonrails.com/ aim: planetargon +1 503 445 2457 +1 877 55 ARGON [toll free] +1 815 642 4068 [fax]
on 2008-12-28 18:59
Hello Robby, I already started. The caterer sends us a menu pdf every week. (like http://gourmetta.de/Speiseplan/kw%2051_speiseplan.pdf) I wanted to establish a "meal" model consisting of title, ingridients, default price, calories etc.) and then have some kind of "schedule" with rows "menu 1...5" for each day. Then I want to fill the meals database with each schedule until all the meals are in the database (over the weeks and months meals will repeat) then the administrator (me) digitaliezes the schedules by for example choosing "Soljanka" for Wednsday and "Menu1". when the schedule is in the database my co-workers can choose their meal for each day. - if theay want far in advance. the night before each day the system shoud generate a list like "Dear caterer, plase send us today (05.01.2009) the following meals 1 x Menu 1 (Soljanka) 2 x Menu 3 (Szegediner Gulasch) best regards your happy customers" and send it by email or fax. That's all! I don't want to extend the system further - it shall just replace the pen-and-paepr solution because sometimes we forget to collect the orders and send them away. A funny part would be if we can later harvest data about our favourites but that's not part of my current demand for a data structure. I chose this very simple task for learning efficient rails development, I do not intend to become a rails guru - just want to automate small things in our office. Christoph