Ask A Question

Notifications

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"})

Reply

Hi
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 6.1.4.1)
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)
=>

Reply

you might have missed out the

"rails db:migrate"

command.

Reply

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 😫

Reply

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.

Reply

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? : )

Reply

You can use ANNOTATE gem for the comments in the models

Reply

I'm getting this error Please help
userpc@iDenniscialsAir scheduled_tweets % bundle
Fetching gem metadata from https://rubygems.org/..........
Resolving dependencies...
Installing bcrypt 3.1.19 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native
extension.

current directory:
/Users/userpc/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bcrypt-3.1.19/ext/mri
/Users/userpc/.rbenv/versions/3.2.2/bin/ruby extconf.rb
creating Makefile

current directory:
/Users/userpc/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bcrypt-3.1.19/ext/mri
make DESTDIR= sitearchdir=./.gem.20230828-54682-3vn48u
sitelibdir=./.gem.20230828-54682-3vn48u clean
xcrun: error: invalid active developer path
(/Library/Developer/CommandLineTools), missing xcrun at:
/Library/Developer/CommandLineTools/usr/bin/xcrun

current directory:
/Users/userpc/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bcrypt-3.1.19/ext/mri
make DESTDIR= sitearchdir=./.gem.20230828-54682-3vn48u
sitelibdir=./.gem.20230828-54682-3vn48u
xcrun: error: invalid active developer path
(/Library/Developer/CommandLineTools), missing xcrun at:
/Library/Developer/CommandLineTools/usr/bin/xcrun

make failed, exit code 1

Gem files will remain installed in
/Users/userpc/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bcrypt-3.1.19
for inspection.
Results logged to
/Users/userpc/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/extensions/x86_64-darwin-20/3.2.0/bcrypt-3.1.19/gem_make.out

/Users/userpc/.rbenv/versions/3.2.2/lib/ruby/site_ruby/3.2.0/rubygems/ext/builder.rb:119:in
run'
/Users/userpc/.rbenv/versions/3.2.2/lib/ruby/site_ruby/3.2.0/rubygems/ext/builder.rb:53:in
block in make'
/Users/userpc/.rbenv/versions/3.2.2/lib/ruby/site_ruby/3.2.0/rubygems/ext/builder.rb:45:in
each'
/Users/userpc/.rbenv/versions/3.2.2/lib/ruby/site_ruby/3.2.0/rubygems/ext/builder.rb:45:in
make'
/Users/userpc/.rbenv/versions/3.2.2/lib/ruby/site_ruby/3.2.0/rubygems/ext/ext_conf_builder.rb:42:in
build'
/Users/userpc/.rbenv/versions/3.2.2/lib/ruby/site_ruby/3.2.0/rubygems/ext/builder.rb:187:in
build_extension'
/Users/userpc/.rbenv/versions/3.2.2/lib/ruby/site_ruby/3.2.0/rubygems/ext/builder.rb:221:in
block in build_extensions'
/Users/userpc/.rbenv/versions/3.2.2/lib/ruby/site_ruby/3.2.0/rubygems/ext/builder.rb:218:in
each'
/Users/userpc/.rbenv/versions/3.2.2/lib/ruby/site_ruby/3.2.0/rubygems/ext/builder.rb:218:in
build_extensions'
/Users/userpc/.rbenv/versions/3.2.2/lib/ruby/site_ruby/3.2.0/rubygems/installer.rb:846:in
build_extensions'
/Users/userpc/.rbenv/versions/3.2.2/lib/ruby/site_ruby/3.2.0/bundler/rubygems_gem_installer.rb:72:in
build_extensions'
/Users/userpc/.rbenv/versions/3.2.2/lib/ruby/site_ruby/3.2.0/bundler/rubygems_gem_installer.rb:28:in
install'
/Users/userpc/.rbenv/versions/3.2.2/lib/ruby/site_ruby/3.2.0/bundler/source/rubygems.rb:202:in
install'
/Users/userpc/.rbenv/versions/3.2.2/lib/ruby/site_ruby/3.2.0/bundler/installer/gem_installer.rb:54:in
install'
/Users/userpc/.rbenv/versions/3.2.2/lib/ruby/site_ruby/3.2.0/bundler/installer/gem_installer.rb:16:in
install_from_spec'
/Users/userpc/.rbenv/versions/3.2.2/lib/ruby/site_ruby/3.2.0/bundler/installer/parallel_installer.rb:156:in
do_install'
/Users/userpc/.rbenv/versions/3.2.2/lib/ruby/site_ruby/3.2.0/bundler/installer/parallel_installer.rb:147:in
block in worker_pool'
/Users/userpc/.rbenv/versions/3.2.2/lib/ruby/site_ruby/3.2.0/bundler/worker.rb:62:in
apply_func'
/Users/userpc/.rbenv/versions/3.2.2/lib/ruby/site_ruby/3.2.0/bundler/worker.rb:57:in
block in process_queue'
/Users/userpc/.rbenv/versions/3.2.2/lib/ruby/site_ruby/3.2.0/bundler/worker.rb:54:in
loop'
/Users/userpc/.rbenv/versions/3.2.2/lib/ruby/site_ruby/3.2.0/bundler/worker.rb:54:in
process_queue'
/Users/userpc/.rbenv/versions/3.2.2/lib/ruby/site_ruby/3.2.0/bundler/worker.rb:90:in
block (2 levels) in create_threads'

An error occurred while installing bcrypt (3.1.19),
and Bundler cannot continue.

Reply
Join the discussion
Create an account Log in

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

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

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