A Rails project has ActiveRecord classes defined for Classroom and Student. If instances of these classes are related so that students are assigned the ID of one particular classroom, which choice shows the correct associations to define?
A.
class Classroom < ActiveRecord::Base
belongs_to :students, class_name: 'Student'
end
class Student < ActiveRecord::Base
belongs_to :classrooms, class_name: 'Classroom'
end
B.
class Student < ActiveRecord::Base
has_many :classrooms, dependent: true
end
class Classroom < ActiveRecord::Base
has_many :students, dependent: false
end
C.
class Student < ActiveRecord::Base
has_many :classrooms
end
class Classroom < ActiveRecord::Base
belongs_to :student
end
D.
class Classroom < ActiveRecord::Base
has_many :students
end
class Student < ActiveRecord::Base
belongs_to :classroom
end