开发者

undefined method `each' Problem/Question?

<% @company.contacts.each do |contactall| %>
        <% contactall.each do |contact| %>
            <%= contact.name %>
            <%= contact.position %>
            <%= contact.email%>
            <%= contact.telephone%>
            <%= contact.source%>开发者_JAVA技巧
            <%= contact.company_id%>
        <% end %>
<% end %>

What's wrong with it? I want to display each contact separately if i do take out <% contactall.each do |contact| %>

and do contact.name i get a bunch of the contacts name's that are associated with the company. help?

I want them all separate.]

The fix:

<% @company.contacts.each do |contact| %>
            <b>Name:</b>
            <%= contact.name %>
            <b>Position:</b>
            <%= contact.position %>
            <b>Email:</b>
            <%= contact.email%>
            <b>Telephone:</b>
            <%= contact.telephone%>
            <b>Source:</b>
            <%= contact.source%><br />
<% end %>


What do you mean separate? This?

<% @company.contacts.each do |contact| %>
  <div>
    <%= contact.name %>
    <%= contact.position %>
    <%= contact.email%>
    <%= contact.telephone%>
    <%= contact.source%>
    <%= contact.company_id%>
  </div>
<% end %>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜