The single-table inheritance mechanism failed to locate the subclass: '1'. 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 [InsertClassNameHere].inheritance_column to use another column for that information.
My Case...I was trying to call the sub-class of one of my classes. (e.g. Group is the class name and Member is the sub-class of the group.)
@group.members, the error mentioned above arises.
Analysis of the Error MessageBased on the error message, it seems that the column name
typeis one of the reserved keywords used in 'storing the class in case of inheritance'.
From experience, it seems that this is the same as using the word lock as column name which is also a reserved keyword.
Solution to the ErrorTo resolve this issue, I simply rename my column to something that I think is not reserved.
You may want to access SQL to manually rename it. Just make sure to update the changes too within the
dbfolder of your rails application.
Another way is to rollback the migration, update the migration file, then migrate it again.
$ rake db:rollback ... $ rake db:migrate
The last approach is applicable if the last table was the one causing the error and the said table is empty. This is because,
rollbackwill completely drop your table from your database.