Load plant parts in db:seed and rake task.

This commit is contained in:
Miles Gould committed 2013-10-30 23:49:34 +00:00
1 parent e9a3c0f4ee
commit f723fea4e2
3 files changed
+46 -1

No files matched your search

+24
View File
@@ -9,6 +9,7 @@ def load_data
load_basic_account_types
create_cropbot
load_crops
load_plant_parts
# for development environments only
if Rails.env.development?
@@ -136,4 +137,27 @@ def load_products
)
end
def load_plant_parts
puts "Loading plant parts..."
plant_parts = [
'fruit',
'flower',
'seed',
'pod',
'leaf',
'stem',
'bark',
'bulb',
'root',
'tuber',
'whole plant',
'other'
]
plant_parts.each do |pp|
PlantPart.find_or_create_by_name!(pp)
end
end
load_data
+20 -1
View File
@@ -207,7 +207,26 @@ namespace :growstuff do
end
end
desc "October 2013: import initial plant parts"
task :import_plant_parts => :environment do
plant_parts = [
'fruit',
'flower',
'seed',
'pod',
'leaf',
'stem',
'bark',
'bulb',
'root',
'tuber',
'whole plant',
'other'
]
plant_parts.each do |pp|
PlantPart.find_or_create_by_name!(pp)
end
end
end
end
+2
View File
@@ -16,3 +16,5 @@ rake growstuff:depopulate_null_island
echo "2013-10-24 - initialize garden locations"
rake growstuff:oneoff:initialize_garden_locations
echo "2013-10-31 - import plant parts"
rake growstuff:oneoff:import_plant_parts