Rails: NameError: uninitialized constant

Some things to try:

  1. Restart the rails console; changes to your models will only get picked up by a rails console that is already open if you do > reload! (although I have found this to be unpredictable), or by restarting the console.

  2. Is your model file called “phone_number.rb” and is it in “/app/models”?

  3. You should double-check the “–sandbox” option on your rails console command. AFAIK, this prevents changes. Try it without the switch.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)