convert ..

parent 9042afbf
...@@ -5,4 +5,7 @@ class Industry < ApplicationRecord ...@@ -5,4 +5,7 @@ class Industry < ApplicationRecord
scope :top_industry, -> { joins(:jobs).group(:industry_id).order('count(job_id) DESC').limit(9) } scope :top_industry, -> { joins(:jobs).group(:industry_id).order('count(job_id) DESC').limit(9) }
scope :all_industry, -> { joins(:jobs).group(:industry_id).order('count(job_id) DESC') } scope :all_industry, -> { joins(:jobs).group(:industry_id).order('count(job_id) DESC') }
def convert_name
name.mb_chars.normalize(:kd).gsub(/[Đđ]/, 'd').gsub(/[^\x00-\x7F]/,'').gsub(/[\W+0-9]/,' ').downcase.to_s.split(' ').join('-')
end
end end
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