mardi 14 juillet 2020

NameError: uninitialized constant User on irb console

when writing User.all

However I don't get this error when using rails c

I have only two models:

user.rb

class User < ApplicationRecord
devise :database_authenticatable, :registerable, :recoverable, :rememberable, :validatable
has_many :items end

item.rb

class Item < ApplicationRecord
belongs_to :user end

my gemfile includes

gem 'devise'

I've checked the models and controller names (singular and plural), and restarting the console I've tried running spring stop and didn't fix the issue

Aucun commentaire:

Enregistrer un commentaire