RE: Inserting the parent Id to the child table

I’ll probably get flamed for saying this but
@addresses =[:addresses])
@[email protected][“student_id”]

Is what I usually do if I’m associating something to another thing that
already exists.

If I have a student already in the DB, I’m just going to embed the id on
the form or in session and directly add the value just like you did…
In my opinion, (and that’s all it is), why should I create an instance
of a student object (1 extra sql statement to populate the object) when
I already have the ID of the record in my session or in my form? I’ll
save some processing time and just associate it by hand.

If I’m creating the student and address at the same time, then other
methods are more appropriate.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs