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.
This commit is contained in:
Maikel Linke
2021-05-21 12:41:55 +10:00
parent 336a8b5825
commit 11cb8cbbdc

View File

@@ -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",