Added ability to delete IP addresses

This commit is contained in:
Gregory Ballantine 2022-12-22 13:08:35 -05:00
parent 2b6a222bcf
commit 57c5fb30c6
2 changed files with 11 additions and 0 deletions

View File

@ -28,4 +28,11 @@ namespace '/ip-tracker' do
redirect '/ip-tracker'
end
get '/delete/:ip_id' do
ip = IpAddress.where(id: params[:ip_id]).first()
ip.delete()
redirect '/ip-tracker'
end
end

View File

@ -8,6 +8,7 @@
<th>Address</th>
<th>DNS Name</th>
<th>Comments</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
@ -16,6 +17,9 @@
<td><%= ip.address %></td>
<td><%= ip.dns_name %></td>
<td><%= ip.comment %></td>
<td>
<a href="/ip-tracker/delete/<%= ip.id %>"><i class="fa-solid fa-trash"></i></a>
</td>
</tr>
<% end %>
</tbody>