Sort Product categories alphabetically by name and fixsample data by fixing taxons taxonomy id

This commit is contained in:
luisramos0
2018-10-27 22:19:30 +01:00
parent acb8ec772e
commit 82befd945b
2 changed files with 2 additions and 2 deletions

View File

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

View File

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