Skip to content

Commit

Permalink
add common name to views
Browse files Browse the repository at this point in the history
  • Loading branch information
one-m1nd committed Mar 6, 2024
1 parent 39dfc10 commit 0889447
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions app/views/families/_family.json.jbuilder
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ end
json.plants family.plants do |plant|
json.id plant.id
json.name plant.name
json.common_name plant.common_name
json.year_acquired plant.year_acquired
json.status plant.status.name
json.created_at plant.created_at
Expand Down
5 changes: 5 additions & 0 deletions app/views/plants/_plant.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@
<td class="border border-slate-900"><%= @plant.name %></td>
</tr>

<tr>
<td class="border border-slate-900">Common Name</td>
<td class="border border-slate-900"><%= @plant.common_name %></td>
</tr>

<tr>
<td class="border border-slate-900">Year Acquired</td>
<td class="border border-slate-900"><%= @plant.year_acquired %></td>
Expand Down
2 changes: 1 addition & 1 deletion app/views/plants/_plant.json.jbuilder
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
json.extract! plant, :id, :name, :year_acquired, :created_at, :updated_at
json.extract! plant, :id, :name, :common_name, :year_acquired, :created_at, :updated_at

json.genus do
json.extract! plant.genus, :id, :name, :created_at, :updated_at
Expand Down
2 changes: 2 additions & 0 deletions app/views/plants/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<thead>
<tr>
<th>Name</th>
<th>Common Name</th>
<th>Family</th>
<th>Genus</th>
<th>Status</th>
Expand All @@ -26,6 +27,7 @@
<% @plants.each do |plant| %>
<tr>
<td class="border border-slate-900"><%= plant.name %></td>
<td class="border border-slate-900"><%= plant.common_name %></td>
<td class="border border-slate-900"><%= plant.family.name %></td>
<td class="border border-slate-900"><%= plant.genus.name %></td>
<td class="border border-slate-900"><%= plant.status.name %></td>
Expand Down

0 comments on commit 0889447

Please sign in to comment.