ActiveRecords: save & relationships

Dear all,

How many steps does ‘save method’ save in has_many/belongs_to
relationships ?

Just to exemplify, let’s suppose:

School has_many Classes
Classes has_many Students

School.name = ‘school’
Class.name = ‘class’
Student1.name = ‘student1’
Student2.name = ‘student2’

Class.students << Student1
Class.students << Student2
School.Classes << Class

School.save

Should i have everything saved in the database ?
In a real situation, i’m having students with null class_id’s.
Is that ok ?

Many thanks,
Andre