From d1eba7aed881302e3a9b26c9a824c7e97988638a Mon Sep 17 00:00:00 2001 From: Justin Edmund Date: Fri, 2 Dec 2022 11:20:22 -0800 Subject: [PATCH] Add == and update search --- app/models/job_skill.rb | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/app/models/job_skill.rb b/app/models/job_skill.rb index 8e47fbe..e487edc 100644 --- a/app/models/job_skill.rb +++ b/app/models/job_skill.rb @@ -3,25 +3,29 @@ class JobSkill < ApplicationRecord belongs_to :job - pg_search_scope :en_search, - against: :name_en, - using: { - tsearch: { - prefix: true, - dictionary: "simple" - } - } + pg_search_scope :en_search, + against: :name_en, + using: { + tsearch: { + prefix: true, + dictionary: "simple", + }, + } - pg_search_scope :jp_search, - against: :name_jp, - using: { - tsearch: { - prefix: true, - dictionary: "simple" - } - } + pg_search_scope :jp_search, + against: :name_jp, + using: { + tsearch: { + prefix: true, + dictionary: "simple", + }, + } def display_resource(skill) skill.name_en end + + def ==(other) + self.class == other.class && @id == other.id + end end