Commit ba6efd34 by Ngô Trung Hưng

validate relationship

parent 4c77e3c8
Pipeline #812 failed with stages
in 0 seconds
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -43,14 +43,12 @@ class ImportData ...@@ -43,14 +43,12 @@ class ImportData
industry_name = val['category'].gsub(',', '/').gsub('/', ' / ') industry_name = val['category'].gsub(',', '/').gsub('/', ' / ')
industry = Industry.find_or_create_by(name: industry_name.strip) industry = Industry.find_or_create_by(name: industry_name.strip)
Job.find_or_create_by(name: val['name'], Job.find_or_create_by(name: val['name'], company_id: company_id) do |job|
company_id: company_id, job.level = val['level']
level: val['level'], job.salary = val['salary']
salary: val['salary'], job.description = desc
description: desc) do |job| job.city_ids.blank? ? job.cities << city : job.cities == city
job.create_date = Time.now job.industry_ids.blank? ? job.industries << industry : job.industries == industry
job.cities << city
job.industries << industry
end end
rescue StandardError => e rescue StandardError => e
logger.error "Import_jobs: #{e}" logger.error "Import_jobs: #{e}"
......
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