<分区>
标签 css ruby-on-rails ruby
我试图让学生的名字出现在 ruby on rails 上 each do 函数的学生图像上。我是菜鸟,所以如果这是一个愚蠢的问题,我深表歉意!
<div id="studentIndex">
<div class="page-content-wrapper">
<h1 class="page-header">Student Index</h1>
<div class="index">
<% @students.each do |student| %>
<%= link_to image_tag(student.img_url), student_path(student) %>
<figcaption> <%= @student.name %> </figcaption>
<% end %>
</div>
</div>
</div>
最佳答案
@student
似乎没有在任何地方定义。根据您提供的内容,使用 <%= student.name %>
而不是 <%= @student.name %>
输出名称时。
关于css - ruby on rails : name of person on hover on a each. 做,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37095474/