I have a model student with a subject and grade attribute. A student can have many subjects and grades, and what I'd like to do is be able to publish the 2nd or 3rd subject listed for a specific student.
For example, the user searches for a student, then clicks on the student, which brings them to a separate page listing information about that particular student (ie, student id:1). Is there code I can add to the view to list the nth item from the subject and grade attributes?
I looked online here and found similar questions, but those solutions related to the model, not the attributes. For example, one solution recommended using the limit method in the controller and another recommended using the following code:
<% firm.state_of_business.split(',').each_with_index do |state, index| %>
<td> <b>State <%= index + 1 %></b> <%= state %>
<%= @student.name %>
<th> Subject </th>
<th> Grade </th>
<td><%= @student.subject %> </td>
<td><%= @student.grade %> </td>
@user = current_user
@student = Student.find(params[:id])
Student: Matt Jones
Try adding this code:
<%= @student.grade.split(',') %>
The  will publish the first item in the array.  will publish the 2nd item, etc. That should work.