作者在 2018-04-01 21:40:53 发布以下内容
使用type作为字段名会出现这个错误:
ActiveRecord::SubclassNotFound: The single-table inheritance mechanism failed to locate the subclass: 'xxxx'. 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 SmsRecord.inheritance_column to use another column for that information.
解决办法:
在相关model中加入“self.inheritance_column = nil”即可,如:
class SmsRecord < ApplicationRecord
self.inheritance_column = nil
end