Railsでこんなエラーが出た。
ActiveRecord::SubclassNotFound in PostController#create The single-table inheritance mechanism failed to locate the subclass: '日本酒'. This error is raised because the column 'type' is reserved for storing the class in case of inheritance. Please rename this column if you didn't intend it to be used for storing the inheritance class or overwrite Post.inheritance_column to use another column for that information.
飲んだ酒をメモするアプリをつくってて、Typeというカラムで酒の種類日本酒
とかワイン
を扱おうと思ったんだけどダメらしい。
reservedとかでてるからactive recordだとType
は予約語扱いなのかも。
怒られたので諦めてType
ではなくCategory
に変えて事なきを得た。