且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何从关联中的链接访问数据?

更新时间:2023-12-03 09:07:34

好.我想,我可以通过年级来获得学生的名字,而不是通过学生来获得年级的名字,所以我做到了

Ok. I figured that instead of getting the name of the Grade throught Students, i can get the student through grades, so I did

<% aula.grades.each do |grade| %>
  <%= link_to grade.student.name, student %>-<%= grade.name %>
<% end %>

现在它好起来了.