RE: Need some advice on DB design

“Tom isn’t wrong, I just wanted to make sure that nobody misunderstands
and starts doing stuff like messageobject.parent_id = parentobject.id”

Can someone explain to me why

messageobject.parent_id = parentobject.id

is incorrect? It seems to work, but I’m just curious as to why it’s bad.
For example… I may have passed the parent id through the url. Seems
odd that I would have to query the db to populate my parent object just
to make the association to the new child object when I could just add
the id to the child’s record.

Of course, if there’s a good reason not to do that, I’d really be
interested to know… I want to make sure I’m doing it right!

Thanks much!
-Brian

Its just not really necessary. Most of the time you are dealing with
straight object (as thats the point of the Ruby and OO in general). I
use it mostly when I dont have/cant represent the object in its
natural state (say selecting an object from a drop down list). In
these cases I stick with the ids, but if I actually have the objects I
use the objects. By type more when we dont have to? :slight_smile:

-nick