Commit 98d6bf79 by Mai Hoang Thai Ha

add link to job

parent 39711e75
class TopController < ApplicationController
def index
@total_job = Job.count
@latest_jobs = Job.order(updated_at: :desc).limit(5).joins(:cities).includes(:company, :cities, :cities_jobs)
@latest_jobs = Job.latest
@top_cities = City.top_jobs
@top_industries = Industry.top_jobs
end
......
class Job < ApplicationRecord
scope :latest, -> { order(updated_at: :desc).limit(5).joins(:cities).includes(:company, :cities, :cities_jobs) }
has_and_belongs_to_many :industries
has_and_belongs_to_many :cities
belongs_to :company
......
......@@ -5,7 +5,7 @@
hr.my-2
- @latest_jobs.each do |job|
.job-item.mb-4
= link_to job.title, "#", class: "job-title"
= link_to job.title, job_path(Job.find_by(title: job.title).id), class: "job-title"
.job-caption
= link_to job.company.name, "#", class: "job-company"
p.job-salary
......
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