Railsでの区分値の扱いについて考える の続きです。 区分値情報をDBに保存しておくか、アプリにのみ保存しておくのか、悩ましい所です。 DBに区分値を保存しておくと、ActiveRecordなオブジェクトになって扱いやすいという利点があります。 しかし、DBにもアプリにも区分値の情報(ProductTypeの1はLADIESであるといった情報)を持つ事になり、二重管理の状態となる可能性があります。 一カ所変えたら対になるもう一方の修正もしないといけない、という状態は、システム保守の観点からはよろしくありません。 私は過去にアプリ側に区分値情報を更新したのに、DB側に区分値情報を入れ忘れていた! という失敗を体験しました。 区分値情報をアプリ、DB両方に持ってるのはやめたい。でもActiveRecordライクなオブジェクトで区分値を扱いたい。 ActiveRecordのデータソースがcla