From 287bd57a4ee844bad81f5abf96a7396e9719d71e Mon Sep 17 00:00:00 2001 From: Andrew Spinks Date: Thu, 1 Aug 2013 10:31:17 +1000 Subject: [PATCH] Fix loading of initial data to ensure there is an itemwise shipping method. --- README.markdown | 4 ++++ lib/tasks/dev.rake | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/README.markdown b/README.markdown index 83b9bc189b..dc7c009fe3 100644 --- a/README.markdown +++ b/README.markdown @@ -44,6 +44,10 @@ Create the development and test databases, using the settings specified in `conf rake db:schema:load db:seed +Load some default data for your environment + + rake openfoodweb:dev:load_sample_data + At long last, your dreams of spinning up a development server can be realised: rails server diff --git a/lib/tasks/dev.rake b/lib/tasks/dev.rake index 576fe8fca9..bb53266596 100644 --- a/lib/tasks/dev.rake +++ b/lib/tasks/dev.rake @@ -30,7 +30,6 @@ namespace :openfoodweb do end end - # -- Enterprises unless Enterprise.count > 0 puts "[db:seed] Seeding enterprises" @@ -39,6 +38,9 @@ namespace :openfoodweb do 3.times { FactoryGirl.create(:distributor_enterprise) } end + unless Spree::ShippingMethod.all.any? { |sm| sm.calculator.is_a? OpenFoodWeb::Calculator::Itemwise } + FactoryGirl.create(:itemwise_shipping_method) + end # -- Products unless Spree::Product.count > 0