NameError: uninitialized constant Object :: User

I searched for other posts that had this problem and couldn't find the one that fixed my problem. My irb is going crazy. I am trying to change user roles in my database, but I can’t even reach my users!

irb(main):001:0> User.all NameError: uninitialized constant Object::User from (irb):1 from c:/Ruby192/bin/irb:12:in `<main>' 

He worked fine, stopped working, everything is in order, and now he has stopped again. I have a user model and users are added. I can’t pinpoint the problem. Let me know what code you need to see. Thanks!

+6
source share
2 answers

You have to run

 ruby script/console # Rails < 3 

or

 rails c # Rails 3.x 

But no (I believe you just ran this)

 irb 
+26
source

Make sure that you are actually using the rails console command, not just irb in the project folder.

+7
source

Source: https://habr.com/ru/post/887949/


All Articles