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