Display list of guests
This commit is contained in:
parent
f66957dd3d
commit
946cd959e2
@ -1,2 +1,5 @@
|
||||
class Guest < ApplicationRecord
|
||||
def full_name
|
||||
"#{first_name} #{last_name}"
|
||||
end
|
||||
end
|
||||
|
@ -3,12 +3,23 @@
|
||||
<h1>Guests</h1>
|
||||
|
||||
<div id="guests">
|
||||
<table>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Email</th>
|
||||
<th>Phone</th>
|
||||
<th colspan="2"></th>
|
||||
</tr>
|
||||
<% @guests.each do |guest| %>
|
||||
<%= render guest %>
|
||||
<p>
|
||||
<%= link_to "Show this guest", guest %>
|
||||
</p>
|
||||
<tr>
|
||||
<td><%= guest.full_name %></td>
|
||||
<td><%= guest.email %></td>
|
||||
<td><%= guest.phone %></td>
|
||||
<td><%= link_to "Show", guest %></td>
|
||||
<td><%= link_to "Edit", edit_guest_path(guest) %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<%= link_to "New guest", new_guest_path %>
|
||||
|
Loading…
x
Reference in New Issue
Block a user