syntax error, unexpected tINTEGER Object::1

The single-table inheritance mechanism failed to locate the subclass

syntax error, unexpected tINTEGER Object::1

......

 

当报这些错时,十之八九就是有个字段被命名为type之类的了。type属于ActiveRecord保留的属性。

 

最简单的办法,字段改名吧,改不了名,那么看看以下这段:

 

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 Site.inheritance_column to use another column for that information.

 

示例:

 

class Space < ActiveRecord::Base
  self.inheritance_column = ''
end

 

如果你的表是从其他应用迁移过来,并且很多地方都依赖这个名字,那建议还是修改这个属性,否则,改名吧。

你可能感兴趣的:(ActiveRecord)