I have a block that I need to nest another block in. Or maybe I don t and I am doing this totally wrong. There is a UNIT and the UNIT has_many COMPANIES Then COMPANIES has_many USERS
在“UNIT展示页面”上,我尝试做这样的事情:
<% @company.each do |c|%>
<%= c.name %>
<% ??? each do |f| %>
<p>
Name: <%= f.name %>
</p>
<% end %>
<% end %>
基本上,对于每个公司,我显示公司的名称,这没有问题,但我试图显示属于该公司的特定用户。我无法在控制器中定义它,因为有多个公司。
That user is: cc = @user.find(:all, :conditions => ["position = ?", "Company Commander"])
我不确定如何通过每个公司进行循环,然后针对该公司进行循环并列出该公司的特定用户。
如果我解释得不好,对不起。我不确定这是否是正确的做法。
提前感谢。