From fbb5d17179af9a6d056add53e3c2063782dac1ff Mon Sep 17 00:00:00 2001 From: Xero Date: Tue, 5 Mar 2024 10:14:07 -0500 Subject: [PATCH] allow year_acquired to be modifiable via ui --- app/controllers/plants_controller.rb | 2 +- app/views/plants/_form.html.erb | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/controllers/plants_controller.rb b/app/controllers/plants_controller.rb index e85b0b2..6856d91 100644 --- a/app/controllers/plants_controller.rb +++ b/app/controllers/plants_controller.rb @@ -68,6 +68,6 @@ def set_plant # Only allow a list of trusted parameters through. def plant_params - params.require(:plant).permit([:name, :family_id, :genus_id, :status_id]) + params.require(:plant).permit([:name, :family_id, :genus_id, :status_id, :year_acquired]) end end diff --git a/app/views/plants/_form.html.erb b/app/views/plants/_form.html.erb index 7916cb4..cfcbb82 100644 --- a/app/views/plants/_form.html.erb +++ b/app/views/plants/_form.html.erb @@ -15,6 +15,7 @@ <%= collection_select(:plant, :family_id, Family.all.sort_by(&:name), :id, :name, prompt: true) %> <%= collection_select(:plant, :genus_id, Genus.all.sort_by(&:name), :id, :name, prompt: true) %> <%= collection_select(:plant, :status_id, Status.all, :id, :name, prompt: true) %> + <%= number_field(:plant, :year_acquired, in: (2017..2050)) %>
<%= form.submit class: "rounded-lg py-3 px-5 bg-blue-600 text-white inline-block font-medium cursor-pointer" %>