Permalink
Browse files

typo

  • Loading branch information...
1 parent e01d34c commit 0fb522b98e60f7f8f9d3f45d77a0e31969fb5127 Denis 'jumph4x committed Jan 3, 2012
Showing with 6 additions and 9 deletions.
  1. +6 −9 app/models/product_datasheet.rb
@@ -108,14 +108,11 @@ def create_variant(attr_hash)
def update_products(key, value, attr_hash)
products_to_update = Product.where(key => value).all
@records_matched = @records_matched + products_to_update.size
- products_to_update.each do |product|
- product.attributes = attr_hash
- if product.changed?
- if product.save
- @records_updated = @records_updated + 1
- else
- @records_failed = @records_failed + 1
- end
+ products_to_update.each do |product|
+ if product.update_attributes attr_hash
+ @records_updated = @records_updated + 1
+ else
+ @records_failed = @records_failed + 1
end
end
@queries_failed = @queries_failed + 1 if products_to_update.size == 0
@@ -125,7 +122,7 @@ def update_variants(key, value, attr_hash)
variants_to_update = Variant.where(key => value).all
@records_matched = @records_matched + variants_to_update.size
variants_to_update.each do |variant|
- if product.update_attributes attr_hash
+ if variant.update_attributes attr_hash
@records_updated = @records_updated + 1
else
@records_failed = @records_failed + 1

0 comments on commit 0fb522b

Please sign in to comment.