summaryrefslogtreecommitdiff
path: root/db/seeds/1_nutrients.rb
diff options
context:
space:
mode:
authorMarius Peter <marius.peter@tutanota.com>2025-08-24 20:29:54 +0200
committerMarius Peter <marius.peter@tutanota.com>2025-08-24 20:29:54 +0200
commit52b044d6a4278c229992404ad5801769c2d13363 (patch)
treeb30b34da58f26117c035391d09366b190350b1e3 /db/seeds/1_nutrients.rb
First commit.
Vive le Castel Peter !
Diffstat (limited to 'db/seeds/1_nutrients.rb')
-rw-r--r--db/seeds/1_nutrients.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/db/seeds/1_nutrients.rb b/db/seeds/1_nutrients.rb
new file mode 100644
index 0000000..dab2249
--- /dev/null
+++ b/db/seeds/1_nutrients.rb
@@ -0,0 +1,24 @@
+NUTRIENTS = [
+ [ "nno3", "nitrate" ],
+ [ "p", "phosphore" ],
+ [ "k", "potassium" ],
+ [ "ca", "calcium" ],
+ [ "mg", "magnésium" ],
+ [ "s", "soufre" ],
+ [ "na", "sodium" ],
+ [ "cl", "chlore" ],
+ [ "si", "silice" ],
+ [ "fe", "fer" ],
+ [ "zn", "zinc" ],
+ [ "b", "bore" ],
+ [ "mn", "manganèse" ],
+ [ "cu", "cuivre" ],
+ [ "mo", "molybdène" ],
+ [ "nnh4", "ammonium" ]
+]
+
+NUTRIENTS.each do |formula, name|
+ Nutrient.find_or_create_by!(formula:) { |n| n.name = name }
+end
+
+puts "Nutrients: #{Nutrient.count}"
Copyright 2019--2025 Marius PETER