简体   繁体   中英

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)"

I'm new to Ruby on Rails and am following a tutorial on learning to create a sign/login page.

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

Make sure that the app/models/application_record.rb file exists and that it has the following (or similar) code

# Base ApplicationRecord Class
class ApplicationRecord < ActiveRecord::Base
  self.abstract_class = true
end

If not, add it. It should have been generated by rails new .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM