Hi all,
Im pretty stumped with how to move forward with the #add_student in Course class. Im stuck at the spec
- Course#add_student relies on Student#enroll
I keep getting the error
NoMethodError:
undefined method `enroll’ for Student:Class
I believe the spec is asking that I access the enroll method from the Student class but I’m not sure how to access it? Or is it asking something else and I’m missing it?
Here is my course code for reference
class Course
attr_accessor :name, :department, :credits, :students
def initialize(name, department, credit_num)
@name = name
@department = department
@credits = credit_num
@students = []
end
def add_student(student)
Student.enroll(student) #I believe this is where the issue lies
@students << student unless @students.include?(student)
end
end