fix page-ID2-ID3

parent 64413466
Pipeline #1373 failed with stages
in 0 seconds
class CityController < ApplicationController
def list_city
@city_vietnam = City.city_vietnam
@city_inter = City.city_inter
@cities_vietnam = City.cities(City::REGION_VN_ID)
@cities_international = City.cities(City::REGION_INTERNATIONAL_ID)
end
end
\ No newline at end of file
......@@ -3,7 +3,8 @@ class City < ApplicationRecord
has_and_belongs_to_many :jobs
has_and_belongs_to_many :companies
LATEST_CITY_NUMBER = 9
REGION_VN_ID = 1
REGION_INTERNATIONAL_ID = 2
scope :top_cities, -> { joins(:jobs).group(:name).order('count_all DESC').count.take(LATEST_CITY_NUMBER) }
scope :city_vietnam, -> { joins(:jobs).group(:name).having('count_all >= ?', 1).where('region_id = 1').order('count_all DESC').count }
scope :city_inter, -> { joins(:jobs).group(:name).having('count_all >= ?', 1).where('region_id = 2').order('count_all DESC').count }
scope :cities, ->(value) { joins(:jobs).group(:name).having('count_all >= ?', 1).where("region_id = #{value}").order('count_all DESC').count }
end
\ No newline at end of file
- provide :title, 'Cities'
- provide :title, 'City List'
.container
h3.p-3
......@@ -12,7 +12,7 @@
h3
| Việt Nam
.row.my-3.text-center.fs-5
- @city_vietnam.each do |name, amount|
- @cities_vietnam.each do |name, amount|
.col-3.p-2.border.mb-1.fw-normal.bg-white
= link_to name, "#"
p.mb-1
......@@ -21,7 +21,7 @@
h3
| International
.row.my-3.text-center.fs-5
- @city_inter.each do |name, amount|
- @cities_international.each do |name, amount|
.col-3.p-2.border.mb-1.fw-normal.bg-white
= link_to name, "#"
p.mb-1
......
- provide :title, 'Industries'
- provide :title, 'Industry List'
.container
h3.p-3
......
Rails.application.routes.draw do
root 'top#home'
get '/cities', to: 'city#list_city'
get '/industries', to: 'industry#list_industry'
resource :cities
resource :industries
get 'cities', to: 'city#list_city'
get 'industries', to: 'industry#list_industry'
end
\ No newline at end of file
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