Commit 50a4e204c1a42aa512b42eb10f16f3751b3769ad
1 parent
bd33b5fb
Exists in
master
and in
28 other branches
Saving products without validation in migration to set category to products without category
(ActionItem1593)
Showing
1 changed file
with
1 additions
and
2 deletions
Show diff stats
db/migrate/20100621235235_set_product_category_id_to_products.rb
... | ... | @@ -2,8 +2,7 @@ class SetProductCategoryIdToProducts < ActiveRecord::Migration |
2 | 2 | def self.up |
3 | 3 | Product.all(:conditions => { :product_category_id => nil }).each do |product| |
4 | 4 | next if product.enterprise.nil? |
5 | - product.product_category = ProductCategory.top_level_for(product.enterprise.environment).first | |
6 | - product.save! | |
5 | + product.update_attribute(:product_category_id, ProductCategory.top_level_for(product.enterprise.environment).first.id) | |
7 | 6 | end |
8 | 7 | end |
9 | 8 | ... | ... |