Are you sure "student_id" is the foreign key? I had a similar problem
the other day.
A one-to-many relationship is set up as so:
class StaffMember < ActiveRecord::Base
has_many :students
...
end
class Student < ActiveRecord::Base
belongs_to :staff_member
...
end
belongs_to( ) declares that the given class has a parent relationship
to the class
containing the declaration - so staffmember is the parent of student
Your student table needs to have a foreign_key called: staff_member_id
I would change your controller as such, so that the logic is in the
controller and not the view:
@student = Student.find(params[:id])
@staff_name = @student.staffmember.first_name
Then in your view
<%= @staff_name%>
Hope this helps -K