From 11cb8cbbdcb0bc763ba1d3f073c45f9bad17a7e1 Mon Sep 17 00:00:00 2001 From: Maikel Linke Date: Fri, 21 May 2021 12:41:55 +1000 Subject: [PATCH] Fix sample_data by filtering params for products We were passing too many parameters to the product creation. Rails 5.2 complained that products don't have a distributor. Filtering the parameters helps. --- lib/tasks/sample_data/product_factory.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/tasks/sample_data/product_factory.rb b/lib/tasks/sample_data/product_factory.rb index 465ed3b64c..56869186da 100644 --- a/lib/tasks/sample_data/product_factory.rb +++ b/lib/tasks/sample_data/product_factory.rb @@ -60,7 +60,7 @@ module SampleData def create_product(hash) log "- #{hash[:name]}" - params = hash.merge( + params = hash.slice(:name, :price).merge( supplier_id: hash[:supplier].id, primary_taxon_id: hash[:taxons].first.id, variant_unit: "weight",