I have a MySQL table. Its light schema as follows
Comments id int not null, auto-inc. unsigned comment text, not null comment_id, int, ##This is the parent_id of the comment if it exist. some other irrelevant fields
In the RoR Comment model I have def Comment < ActiveRecord::Base has_and_belongs_to_many :comments end
Java hibernate comparison (high level)
What I have to do in hibernate is change the hbm XML class for Comments to let hibernate know that Comments could have many children with a default attrib as Lazy (More on Lazy to come). Then I would have to edit the Comment Class to include the Set (childrenSet) that I just set up in the Comments hbm XML file. Now when I get a comment, any comment I could check the set to see if I had any children. The important part here is that as long as I had my DB session open, I would have to "Request" the childrenSet by asking for the childrenSet (ie getChildrenSet). If I never asked for the childrenSet hibernate would never get nor instantiate those objects (this is the definition of "lazy" mentioned above)
So what I would like to know is two things.
How would I get all children for a particular comment in RoR in the view? Is there such a feature as lazy in RoR?
BTW, do you think the field named comment in my comments table could get a little tricky with all the RoR rules?