From: Craig Johnson Date: 2007-07-14T12:04:04+09:00 Subject: Re: Web Databases and Objects John, appreciate your shot at it... But---(and I don't' want to be a "Joe" here...) if anyone has build a site/ruby app which creates and manipulates complex object classes (things that have Arrays, or Hashes within their Class definitions)... How did you store those things in the database... for example ... if I have a recipe which has Steps which have ingredients tied to those steps I might want to create an array of Steps, each of which can have both Actions and an array of ingredients... But...once a user has put in the receipe...and I've populated all those objects within the instance.... I want to save it... How? throw me some ideas... I'm thinking that I have to serialize the class...and that is what's needed. cj:) -----Original Message----- From: John Joyce [mailto:dangerwillrobinsondanger@gmail.com] Sent: Friday, July 13, 2007 8:45 PM To: ruby-talk ML Subject: Re: Web Databases and Objects On Jul 13, 2007, at 9:22 PM, Craig Johnson wrote: > OK..I'm having a mental block. > I have a website started with Ruby on Rails. > I've got this object Hierarchy in mind. > the simple "it's a database" stuff is fine.but when it comes to > the Arrays > of Hashes that make > up some of the objects within the custom class.the relationship > to the > database and what happens when > I close down the environment (and in future want to start up site.) > So how do I Save and retrieve that stuff? do I have to do the > Object/Relational mapping myself or > > do I depend on the "serialize" function/method for the class? > the examples I've seen don't have a user create and populate a complex > object and then > > save and retrieve it...things that are saved and retrieved seem pretty > simple---though there > > are lots of instantiations and work live---but I need to create a > datastore > that gets extended and > > hit with queries---Am I going to have to recreate and repopulate via > "deserialize" ? > I imagine the answer is obvious---but it eludes my feeble mind.. > > Help? > cj:-) > Rails is BIG. Take it slowly. I'm still struggling with it too. There are some good books on it. Work through them. It takes time for the details to start sinking in. Don't rush yourself. Rails comes with the stigma of fast development, but the part about learning curve is often lost in the hype. I'm frustrated with it myself, but the reality is, a framework takes time to learn AND it pays off in the end because it's better than building all of that functionality yourself. in the meantime, check out streamlined... John Joyce