belongs_to :owner,class_name: User
相反:
belongs_to :owner,class_name: "User"
由于这个原因,您应该使用“User”,如选项名称:: class_name,not:class所暗示的那样.