You are getting that error because it should be:
@project.each do |p|
@students << Student.find_by_id(p.receiver_id)
end
If you only want the first names and last names, then you might consider:
@project.each do |p|
student = Student.find_by_id(p.receiver_id)
@students << { :first_name => student.first_name, :last_name => student.last_name }
end
If you want an array, then:
@project.each do |p|
student = Student.find_by_id(p.receiver_id)
@students << [student.first_name, student.last_name ]
end
The first version would give you an array of hashes. The second version would give you an array of arrays.