다음은 저에게 계정 목록을 제공하는 코드입니다.계정에서 프로젝트 목록에 액세스하기
<% @accounts.each do |account| %>
<li><%= link_to account.name %></li>
<% end %>
내 계정의 프로젝트 목록에 액세스하는 방법.
다음은 저에게 계정 목록을 제공하는 코드입니다.계정에서 프로젝트 목록에 액세스하기
<% @accounts.each do |account| %>
<li><%= link_to account.name %></li>
<% end %>
내 계정의 프로젝트 목록에 액세스하는 방법.
이 시도 : Incase의 당신을
:
<% @accounts.each do |account| %>
<li><%= link_to account.name %></li>
<% account.projects.each do |project| %>
<li><%= link_to project %></li> #this will give you individual project associated with that account
<% end %>
<% end %>
편집 : 각 개별 프로젝트에 대한 LINK_TO를 원하는 경우
<% @accounts.each do |account| %>
<li><%= link_to account.name %></li>
<li><%= link_to account.projects %></li> #this will give you a collection of projects associated with that account
<% end %>
는 다음과 같은 또 다른 루프를 사용해야합니다 계정에 대한 프로젝트가 없습니다.
루프
시도의 account.projects : 당신은 같은 뜻이
@Mandeep 내부 (210)
– theJava