Displaying 1 result from an estimated 1 matches for "associate_pupil_to_teacher".
2007 Dec 04
5
when to save, session reflect saves?
I am trying to clean up unnecessary lines (even as I hack my way forward
adding more garbage)
I have two questions on lines I have trying to keep the database and
session info reflecting changes:
def associate_pupil_to_teacher
@teacher = session[:teacher]
@pupil = Pupil.find(params[:id])
@teacher.pupils << @pupil
@teacher.save #Q1
session[:teacher] = @teacher #Q2
end
#Q1 do i need to do a save or is the objected reffered to by @teacher
automatically saved when association is augmented?
#Q2 if I want t...