```ruby
namespace :islay_shop do
  namespace :db do
    desc "Loads in seed data for bootstrapping a fresh Islay app."
    task :seed => :environment do
      require 'islay/spec'
      ProductCategory.make!(15)
      OrderProcess.make(80).map do |o|
        begin
          o.run!(:add)
        rescue Sku::InsufficientStock
          # Just ignore this guy
        end
      end
    end
  end
end```

Add a rake task for repairing product and category orders.
user
```ruby
namespace :islay_shop do
  namespace :db do
    desc "Fixes ordering of product categories and products"
    task :order_fix => :environment do
      Product.all.group_by {|p| p.product_category_id}.each do |g, a|
        a.each_with_index {|p, i| p.update_attribute :position, i + 1}
      end

      ProductCategory.all.group_by {|p| p.product_category_id || 'NULL'}.each do |g, a|
        a.each_with_index {|p, i| p.update_attribute :position, i + 1}
      end
    end

    desc "Loads in seed data for bootstrapping a fresh Islay app."
    task :seed => :environment do
      require 'islay/spec'
      ProductCategory.make!(15)
      OrderProcess.make(80).map do |o|
        begin
          o.run!(:add)
        rescue Sku::InsufficientStock
          # Just ignore this guy
        end
      end
    end
  end
end```
assistant