Commit 096a9a9a by Trịnh Hoàng Phúc

Merge branch 'feature/rake_task_import_csv' into 'master'

Fix import csv

See merge request !13
parents b465fec5 a7440cbb
Pipeline #587 canceled with stages
in 0 seconds
......@@ -28,6 +28,7 @@ namespace :import do
job_attributes[:company_id] = check_exist_or_create_company(company_attributes)
# Create job
job = check_exist_or_create_job(job_attributes)
if job.cities.count == 0 && job.industries.count == 0
# Industry
industry = check_exist_or_create_industry(row[1])
# Industry job
......@@ -38,6 +39,7 @@ namespace :import do
job.cities << city
end
end
end
def check_exist_or_create_company(company_attributes)
find_company = Company.find_or_create_by(company_attributes)
......
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