hensei-api/app/models/summon.rb
Justin Edmund d6cad414ac Fix searching in Japanese (#99)
This was broken because we were using the browser-provided locale as a prefix to our method, but that is 'ja' and our methods were prefixed with 'jp'.
2023-06-19 00:35:22 -07:00

30 lines
647 B
Ruby

# frozen_string_literal: true
class Summon < ApplicationRecord
include PgSearch::Model
pg_search_scope :en_search,
against: :name_en,
using: {
trigram: {
threshold: 0.18
}
}
pg_search_scope :ja_search,
against: :name_jp,
using: {
tsearch: {
prefix: true,
dictionary: 'simple'
}
}
def blueprint
SummonBlueprint
end
def display_resource(summon)
summon.name_en
end
end