Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在 Rails 中遍历 User 模型并显示一些列后,在视图的末尾我得到:
#<User:0x1095e07b8>#<User:0x1095dfed0>#<User:0x1095de080>
关于如何摆脱这个的任何想法?还有什么意思?
您可能正在将其用于您的循环:
<%= User.all.each do |user| %>
等号将该函数的输出打印到页面。删除等号以省略输出:
<% User.all.each do |user| %>
循环仍然会发生,但输出不会到达视图。