I’m super a super ruby nuby, so bare with me. I am working on a small
app that has a particular form that I am having a rough time figuring
out the best to way to handle.
Basically here it is, each school has one or more classrooms, and each
classroom can have one or more teachers.
Here’s what I am trying to do (edit a school):
- click on a link to edit a School
- The school form loads and with it, all it’s classrooms are listed (I
have this part ok)
- part I’m trying to think of how to do is:
- for each classroom, grabbing all the teachers…Would do this in the
controller or the rhtml file itself? If in the controller, how? It’s
probably a stupid question, but I can’t see it. Can you do a loop
through each of the classrooms and assign them an array of teachers?
here is the controller for the form so far:
@school = School.find(params[:id])
@classrooms = Classroom.find(:all,
:conditions => [“school_id = ?”, params[:id])