Commit 9172a24c by vulehuan

update code: continue insert products when an error has been occured

parent b044beed
......@@ -80,22 +80,26 @@ namespace :db do
price_currency = price.attributes["currency"]
price = price.text
Product.create!(
name: name,
description: description,
headline: headline,
availability: availability,
code: code,
condition: condition,
image_small: image_small,
image_medium: image_medium,
review_rate: review_rate,
review_count: review_count,
price_currency: price_currency,
price: price,
product_category_id: category_id,
status: true
)
begin
Product.create!(
name: name,
description: description,
headline: headline,
availability: availability,
code: code,
condition: condition,
image_small: image_small,
image_medium: image_medium,
review_rate: review_rate,
review_count: review_count,
price_currency: price_currency,
price: price,
product_category_id: category_id,
status: true
)
rescue
next
end
end
end
end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment