Commit 606ad3ba by Truong Ba Dieu

Fix pull request 1

parent 88f0ec8a
- if current_user.present?
- if policy(:product).new?
li
= link_to "New product", new_product_path
......
......@@ -20,7 +20,10 @@ namespace :crawler do
items.each do |item|
break if category.products.count >= 20 # limit 20 products each category
param_item = VacuumAwsService.parse_item(item)
category.products.create(param_item) if param_item.present? && category.products.where(pid: param_item[:pid], title: param_item[:title]).limit(1).blank?
if param_item.present? && category.products.where(pid: param_item[:pid], title: param_item[:title]).limit(1).blank? &&
category.products.find_by(title: param_item["title"]).blank?
category.products.create(param_item)
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