[英]Ruby on rails 5 uninitialized constant ApplicationRecord (NameError)
I keep getting this error "/home/ubuntu/workspace/au5/app/models/user.rb:1:in `': uninitialized constant ApplicationRecord (NameError)" 我不断收到此错误“ /home/ubuntu/workspace/au5/app/models/user.rb:1:在`':未初始化的常量ApplicationRecord(NameError)”
I'm new to Ruby on Rails and am following a tutorial on learning to create a sign/login page. 我是Ruby on Rails的新手,并且正在关注有关学习如何创建登录/登录页面的教程。
user.rb user.rb
class User < ApplicationRecord
has_secure_password
end
What am i doing wrong? 我究竟做错了什么?
Code: 码:
if you want to have a look the files can be find here 如果您想看一下文件,可以在这里找到
https://preview.c9users.io/salman15/consulegem https://preview.c9users.io/salman15/consulegem
Make sure that the app/models/application_record.rb
file exists and that it has the following (or similar) code 确保app/models/application_record.rb
文件存在,并且具有以下(或类似的)代码
# Base ApplicationRecord Class
class ApplicationRecord < ActiveRecord::Base
self.abstract_class = true
end
If not, add it. 如果没有,请添加它。 It should have been generated by rails new
. 它应该由rails new
生成。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.