ファイル
btrc-hub/backend/app/models/script.rb
T
2026-10-19 12:46:57 +09:00

12 行
416 B
Ruby

class Script < ApplicationRecord
has_many :locales, foreign_key: :script_code, primary_key: :code
# Canonical keys come first so reads and plucks retain ISO 15924 spelling.
# Legacy keys preserve the existing enum predicates, scopes and queries.
enum :code, { 'Jpan' => 'Jpan', 'Kana' => 'Kana', jpan: 'Jpan', kana: 'Kana' }
def code= value
super(self.class.codes.fetch(value.to_s, value))
end
end