i have three model project_site, project_manager and human_resource. each model has status Boolean attribute i want to print "approve" only if all status==true but want to print "reject" if any one of the status is set to false. each status has nil value by default.
<% if project_site.human_resources.empty? %>
<td class="pending fi-eye"><%= " Pending" %></td>
<% elsif %>
<% project_site.human_resources.each do |human_resource| %>
<% if human_resource.status == false %>
<td class="rejected fi-x"><%= ' Rejected' %></td>
<% elsif human_resource.status == true %>
<td class="approved fi-check"><%= " Approved" %></td>
<% end %>
<% end %>
<% elsif %>
<% project_site.project_directors.each do |project_director| %>
<% if project_director.status == false %>
<td class="rejected fi-x"><%= ' Rejected' %></td>
<% end %>
<% end %>
<% elsif %>
<% project_site.project_managers.each do |project_manager| %>
<% if project_manager.status == false %>
<td class="rejected fi-x"><%= ' Rejected' %></td>
<% end %>
<% end %>
<% end %>
Aucun commentaire:
Enregistrer un commentaire