Commit 9172a24c by vulehuan

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

parent b044beed
...@@ -80,6 +80,7 @@ namespace :db do ...@@ -80,6 +80,7 @@ namespace :db do
price_currency = price.attributes["currency"] price_currency = price.attributes["currency"]
price = price.text price = price.text
begin
Product.create!( Product.create!(
name: name, name: name,
description: description, description: description,
...@@ -96,6 +97,9 @@ namespace :db do ...@@ -96,6 +97,9 @@ namespace :db do
product_category_id: category_id, product_category_id: category_id,
status: true status: true
) )
rescue
next
end
end end
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