且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

未初始化的常量ApplicationRecord

更新时间:2023-02-12 16:52:35

您似乎正在使用Rails 5教程,但是正在使用Rails4.在Rails 5中,所有模型都继承自ApplicationRecord,而Rails 4则继承自ApplicationRecord. c4>

It appears you're using the Rails 5 tutorial, but working with Rails 4. In Rails 5 all models inherit from ApplicationRecord, while Rails 4 from ActiveRecord::Base

立即修复:

class User < ActiveRecord::Base
...
end

长期修复,切换到Rails 5并学习Rails 5

Long term fix, switch to Rails 5 and learn with Rails 5