加入我有类似您在查看
<% @users.each do |u| %>
...
<% @interests.each do |i| %>
<% if i joins u in interests_users %> <-- That is not working that way! = Problem
...
<% i.id %>
...
<% end %>
<% end %>
...
<% end %>
我需要输出的每个息的ID加入用户interests_users为每一位用户。但我不能为每个用户使用一个sql查询,因为这对于服务器来说太多了,所以我查询了整个兴趣表并想在视图中对其进行过滤。 任何人都有一个简单的解决方案呢?
您能定义更多的问题吗?你想达到什么目的? – 2012-01-16 09:07:55