エラー
Railsのカラム名にtype
という名称を使用していると以下のようなエラーが出る
/app/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.2.1/lib/active_record/inheritance.rb:226:in `rescue in find_sti_class': The single-table inheritance mechanism failed to locate the subclass: 'matome'. 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 GameCategory.inheritance_column to use another column for that information. (ActiveRecord::SubclassNotFound)
参考: qiita.com
カラム名の変更
リネームしたほうが良さそうなので、大人しくリネームする
class ModColumnNameToTableName < ActiveRecord::Migration[5.2] def change rename_column :table_name, :type, :new_column_name end end