diff --git a/db/migrate/20100621235235_set_product_category_id_to_products.rb b/db/migrate/20100621235235_set_product_category_id_to_products.rb index b271b0c..614172f 100644 --- a/db/migrate/20100621235235_set_product_category_id_to_products.rb +++ b/db/migrate/20100621235235_set_product_category_id_to_products.rb @@ -2,8 +2,7 @@ class SetProductCategoryIdToProducts < ActiveRecord::Migration def self.up Product.all(:conditions => { :product_category_id => nil }).each do |product| next if product.enterprise.nil? - product.product_category = ProductCategory.top_level_for(product.enterprise.environment).first - product.save! + product.update_attribute(:product_category_id, ProductCategory.top_level_for(product.enterprise.environment).first.id) end end -- libgit2 0.21.2