0

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

a14m
  • 7,808
  • 8
  • 50
  • 67
Salman
  • 1,109
  • 3
  • 25
  • 55

1 Answers1

4

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.

Hallgeir Wilhelmsen
  • 1,014
  • 1
  • 10
  • 18
a14m
  • 7,808
  • 8
  • 50
  • 67