gitshowcase/gitshowcase

View on GitHub
app/models/country.rb

Summary

Maintainability
A
0 mins
Test Coverage
class Country < ApplicationRecord
  include PgSearch

  # Relationships
  belongs_to :continent
  has_many :states
  has_many :timezones
  has_many :users

  # Name search
  pg_search_scope :search,
                  against: :name,
                  ignoring: :accents,
                  using: {trigram: {threshold: 0.2}}
end