From 82befd945be73aaa419759a91c36f4a02679eafd Mon Sep 17 00:00:00 2001 From: luisramos0 Date: Sat, 27 Oct 2018 22:19:30 +0100 Subject: [PATCH] Sort Product categories alphabetically by name and fixsample data by fixing taxons taxonomy id --- app/views/spree/admin/products/_primary_taxon_form.html.haml | 2 +- lib/tasks/dev.rake | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/spree/admin/products/_primary_taxon_form.html.haml b/app/views/spree/admin/products/_primary_taxon_form.html.haml index 51da47f0f4..d8a6b1715e 100644 --- a/app/views/spree/admin/products/_primary_taxon_form.html.haml +++ b/app/views/spree/admin/products/_primary_taxon_form.html.haml @@ -2,5 +2,5 @@ = f.label :primary_taxon_id, t('.product_category') %span.required * %br - = f.collection_select(:primary_taxon_id, Spree::Taxon.all, :id, :name, {:include_blank => true}, {:class => "select2 fullwidth"}) + = f.collection_select(:primary_taxon_id, Spree::Taxon.order(:name), :id, :name, {:include_blank => true}, {:class => "select2 fullwidth"}) = f.error_message_on :primary_taxon_id diff --git a/lib/tasks/dev.rake b/lib/tasks/dev.rake index 6fa9af6f3e..ed3ef2352c 100644 --- a/lib/tasks/dev.rake +++ b/lib/tasks/dev.rake @@ -38,7 +38,7 @@ namespace :openfoodnetwork do taxonomy_root = taxonomy.root ['Vegetables', 'Fruit', 'Oils', 'Preserves and Sauces', 'Dairy', 'Meat and Fish'].each do |taxon_name| - FactoryBot.create(:taxon, name: taxon_name, parent_id: taxonomy_root.id) + FactoryBot.create(:taxon, name: taxon_name, parent_id: taxonomy_root.id, taxonomy_id: taxonomy.id) end end