Display table arrangements

This commit is contained in:
Manuel Bustillo 2024-07-25 09:39:34 +02:00
parent 77be7d505a
commit 45974fcf7e
2 changed files with 17 additions and 0 deletions

View File

@ -5,5 +5,6 @@ class TablesArrangementsController < ApplicationController
def show def show
@tables_arrangement = TablesArrangement.find(params[:id]) @tables_arrangement = TablesArrangement.find(params[:id])
@seats = @tables_arrangement.seats.includes(:guest).group_by(&:table_number)
end end
end end

View File

@ -0,0 +1,16 @@
<h1>ID: <%= @tables_arrangement.id %></h1>
<p>Discomfort: <%= @tables_arrangement.discomfort %></p>
<h2>Seats</h2>
<% @seats.each do |table_number, seats| %>
<h3>Table <%= table_number %></h3>
<ul>
<% seats.each do |seat| %>
<li><%= seat.guest.full_name %></li>
<% end %>
</ul>
<% end %>