Rails for Beginners Part 11: Creating the User model Discussion
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)
=>
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? : )
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'
block in make'
/Users/userpc/.rbenv/versions/3.2.2/lib/ruby/site_ruby/3.2.0/rubygems/ext/builder.rb:53:in
/Users/userpc/.rbenv/versions/3.2.2/lib/ruby/site_ruby/3.2.0/rubygems/ext/builder.rb:45:in
each'
make'
/Users/userpc/.rbenv/versions/3.2.2/lib/ruby/site_ruby/3.2.0/rubygems/ext/builder.rb:45:in
/Users/userpc/.rbenv/versions/3.2.2/lib/ruby/site_ruby/3.2.0/rubygems/ext/ext_conf_builder.rb:42:in
build'
build_extension'
/Users/userpc/.rbenv/versions/3.2.2/lib/ruby/site_ruby/3.2.0/rubygems/ext/builder.rb:187:in
/Users/userpc/.rbenv/versions/3.2.2/lib/ruby/site_ruby/3.2.0/rubygems/ext/builder.rb:221:in
block in build_extensions'
each'
/Users/userpc/.rbenv/versions/3.2.2/lib/ruby/site_ruby/3.2.0/rubygems/ext/builder.rb:218:in
/Users/userpc/.rbenv/versions/3.2.2/lib/ruby/site_ruby/3.2.0/rubygems/ext/builder.rb:218:in
build_extensions'
build_extensions'
/Users/userpc/.rbenv/versions/3.2.2/lib/ruby/site_ruby/3.2.0/rubygems/installer.rb:846:in
/Users/userpc/.rbenv/versions/3.2.2/lib/ruby/site_ruby/3.2.0/bundler/rubygems_gem_installer.rb:72:in
build_extensions'
install'
/Users/userpc/.rbenv/versions/3.2.2/lib/ruby/site_ruby/3.2.0/bundler/rubygems_gem_installer.rb:28:in
/Users/userpc/.rbenv/versions/3.2.2/lib/ruby/site_ruby/3.2.0/bundler/source/rubygems.rb:202:in
install'
install'
/Users/userpc/.rbenv/versions/3.2.2/lib/ruby/site_ruby/3.2.0/bundler/installer/gem_installer.rb:54:in
/Users/userpc/.rbenv/versions/3.2.2/lib/ruby/site_ruby/3.2.0/bundler/installer/gem_installer.rb:16:in
install_from_spec'
do_install'
/Users/userpc/.rbenv/versions/3.2.2/lib/ruby/site_ruby/3.2.0/bundler/installer/parallel_installer.rb:156:in
/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'
apply_func'
/Users/userpc/.rbenv/versions/3.2.2/lib/ruby/site_ruby/3.2.0/bundler/worker.rb:62:in
/Users/userpc/.rbenv/versions/3.2.2/lib/ruby/site_ruby/3.2.0/bundler/worker.rb:57:in
block in process_queue'
loop'
/Users/userpc/.rbenv/versions/3.2.2/lib/ruby/site_ruby/3.2.0/bundler/worker.rb:54:in
/Users/userpc/.rbenv/versions/3.2.2/lib/ruby/site_ruby/3.2.0/bundler/worker.rb:54:in
process_queue'
block (2 levels) in create_threads'
/Users/userpc/.rbenv/versions/3.2.2/lib/ruby/site_ruby/3.2.0/bundler/worker.rb:90:in
An error occurred while installing bcrypt (3.1.19),
and Bundler cannot continue.