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.
这里绝对是新的。
对于我的索引视图,我将如何更改循环条件<% @complaints.each do |complaint| %>以执行类似的操作where @complaint.user_id == current_user?
<% @complaints.each do |complaint| %>
where @complaint.user_id == current_user
最好在控制器中执行此操作,但无论如何在视图中它是这样的:
<% @complaints.where(user_id: current_user).each do |complaint| %>