From 088944765520f59b51a35c735a8858f7face1e27 Mon Sep 17 00:00:00 2001 From: Xero Date: Wed, 6 Mar 2024 10:18:10 -0500 Subject: [PATCH] add common name to views --- app/views/families/_family.json.jbuilder | 1 + app/views/plants/_plant.html.erb | 5 +++++ app/views/plants/_plant.json.jbuilder | 2 +- app/views/plants/index.html.erb | 2 ++ 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/app/views/families/_family.json.jbuilder b/app/views/families/_family.json.jbuilder index cc980f5..db995ab 100644 --- a/app/views/families/_family.json.jbuilder +++ b/app/views/families/_family.json.jbuilder @@ -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 diff --git a/app/views/plants/_plant.html.erb b/app/views/plants/_plant.html.erb index 3b689b6..88a38af 100644 --- a/app/views/plants/_plant.html.erb +++ b/app/views/plants/_plant.html.erb @@ -24,6 +24,11 @@ <%= @plant.name %> + + Common Name + <%= @plant.common_name %> + + Year Acquired <%= @plant.year_acquired %> diff --git a/app/views/plants/_plant.json.jbuilder b/app/views/plants/_plant.json.jbuilder index 0e8a740..2d9df17 100644 --- a/app/views/plants/_plant.json.jbuilder +++ b/app/views/plants/_plant.json.jbuilder @@ -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 diff --git a/app/views/plants/index.html.erb b/app/views/plants/index.html.erb index f9240c4..7906d34 100644 --- a/app/views/plants/index.html.erb +++ b/app/views/plants/index.html.erb @@ -14,6 +14,7 @@ Name + Common Name Family Genus Status @@ -26,6 +27,7 @@ <% @plants.each do |plant| %> <%= plant.name %> + <%= plant.common_name %> <%= plant.family.name %> <%= plant.genus.name %> <%= plant.status.name %>