Commit 34e7d4fe by nnnghia98

order city on top page

parent 3aa0194a
class TopsController < ApplicationController
def index
@vn_cities = City.vn_cities
@vn_cities = City.city_order.take(Settings.top.city.limit)
@industries = Industry.all
@jobs = Job.page(params[:page]).per(Settings.job.per_page)
end
......
......@@ -23,4 +23,8 @@ class City < ApplicationRecord
def job_count
@job_count ||= jobs.count
end
def self.city_order
@city_order ||= all.sort_by(&:job_count).reverse
end
end
......@@ -3,3 +3,7 @@ job:
csv:
file_path: "jobss.csv"
top:
city:
limit: 9
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