All threads / Rails for Beginners Part 11: Creating the User model Discussion
Ask A Question


You’re not receiving notifications from this thread.

Rails for Beginners Part 11: Creating the User model Discussion

Nicely done. User.all , User.first, User.last, User.create({hash:"hash"})

I get an error on User.all
Object doesn't support #inspect

my console output
ubuntu@LAPTOP-MIO8EIGO:~/projects/scheduled_tweets$ rails c
Loading development environment (Rails
irb(main):001:0> User
=> User (call 'User.connection' to establish a connection)
irb(main):002:0> User.all
(51.7ms) SELECT sqlite_version()
User Load (1.2ms) SELECT "users".
FROM "users"
(Object doesn't support #inspect)

you might have missed out the

"rails db:migrate"


I had the same error and I was also getting

PG::UndefinedTable: ERROR:  relation "users" does not exist (ActiveRecord::StatementInvalid)
LINE 9:  WHERE a.attrelid = '"users"'::regclass

when I was running User.create.... I had missed the command rails db:migrate 😫

I don't know why I can't install the bcrypt. I tried several versions and lots of uninstalling and reinstalling the gem. At first I had the error about the .gemrc file but after that I created the file manually I can successfully run the bundle command but every time I can't run the rails server command and a long log appear.

This line is already in the Gemfile at around line 37:
gem "bcrypt", "~> 3.1.7"

You just need to uncomment it and then run bundle. Did you try this? : )

You can use ANNOTATE gem for the comments in the models

Join the discussion

Want to stay up-to-date with Ruby on Rails?

Join 70,078+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.

    logo Created with Sketch.

    Screencast tutorials to help you learn Ruby on Rails, Javascript, Hotwire, Turbo, Stimulus.js, PostgreSQL, MySQL, Ubuntu, and more. Icons by Icons8

    © 2023 GoRails, LLC. All rights reserved.