このコミットが含まれているのは:
2026-10-19 12:46:57 +09:00
コミット 4e656bad55
4個のファイルの変更、43行の追加、13行の削除
+7 -1
ファイルの表示
@@ -1,5 +1,11 @@
class Script < ApplicationRecord
has_many :locales, foreign_key: :script_code, primary_key: :code
enum :code, jpan: 'Jpan', kana: 'Kana'
# 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