Commit 5c50f4b3 by Xuan Trung Le

optimize code

parent 3e82e42a
...@@ -28,15 +28,14 @@ class Job < ApplicationRecord ...@@ -28,15 +28,14 @@ class Job < ApplicationRecord
# Company # Company
company = Company.find_by(name: item[:company_name]) company = Company.find_by(name: item[:company_name])
job.company =
if company.nil? if company.nil?
Company.create(name: item[:company_name], company = Company.create(name: item[:company_name],
location: item[:company_location], location: item[:company_location],
description: item[:company_description]) description: item[:company_description])
else
company
end end
job.company.cities = job.cities job.company = company
job.company.cities << (job.cities - job.company.cities)
# Industry # Industry
unless item[:industry].blank? unless item[:industry].blank?
......
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