using console

Asked

Viewed 113 times

3

Starting project with Vagrant, when using the console, appears a message of 'Unable to load Pry' see below full:

$ rails c
Loading development environment (Rails 4.1.4)
=> Unable to load pry
irb(main):001:0>

after that I try to run.

irb(main):001:0> user = User.new

and then said informs a message 'Unable to locate "users" from desktop'

irb(main):001:0> user = User.new
ActiveRecord::StatementInvalid: Could not find table 'users'
    from /home/vagrant/local/ruby/gems/gems/activerecord-4.1.4/lib/active_record/connection_adapters/sqlite3_adapter.rb:515:in `table_structure'
    from /home/vagrant/local/ruby/gems/gems/activerecord-4.1.4/lib/active_record/connection_adapters/sqlite3_adapter.rb:390:in `columns'
    from /home/vagrant/local/ruby/gems/gems/activerecord-4.1.4/lib/active_record/connection_adapters/schema_cache.rb:93:in `block in prepare_default_proc'
    from /home/vagrant/local/ruby/gems/gems/activerecord-4.1.4/lib/active_record/connection_adapters/schema_cache.rb:44:in `yield'
    from /home/vagrant/local/ruby/gems/gems/activerecord-4.1.4/lib/active_record/connection_adapters/schema_cache.rb:44:in `columns'
    from /home/vagrant/local/ruby/gems/gems/activerecord-4.1.4/lib/active_record/model_schema.rb:214:in `columns'
    from /home/vagrant/local/ruby/gems/gems/activerecord-4.1.4/lib/active_record/model_schema.rb:223:in `columns_hash'
    from /home/vagrant/local/ruby/gems/gems/activerecord-4.1.4/lib/active_record/inheritance.rb:180:in `subclass_from_attributes?'
    from /home/vagrant/local/ruby/gems/gems/activerecord-4.1.4/lib/active_record/inheritance.rb:23:in `new'
    from (irb):1
    from /home/vagrant/local/ruby/gems/gems/railties-4.1.4/lib/rails/commands/console.rb:90:in `start'
    from /home/vagrant/local/ruby/gems/gems/railties-4.1.4/lib/rails/commands/console.rb:9:in `start'
    from /home/vagrant/local/ruby/gems/gems/railties-4.1.4/lib/rails/commands/commands_tasks.rb:69:in `console'
    from /home/vagrant/local/ruby/gems/gems/railties-4.1.4/lib/rails/commands/commands_tasks.rb:40:in `run_command!'
    from /home/vagrant/local/ruby/gems/gems/railties-4.1.4/lib/rails/commands.rb:17:in `<top (required)>'
    from /home/vagrant/local/ruby/gems/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:247:in `require'
    from /home/vagrant/local/ruby/gems/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:247:in `block in require'
    from /home/vagrant/local/ruby/gems/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:232:in `load_dependency'
    from /home/vagrant/local/ruby/gems/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:247:in `require'
    from /vagrant/colchonet/bin/rails:8:in `<top (required)>'
    from /home/vagrant/local/ruby/gems/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:241:in `load'
    from /home/vagrant/local/ruby/gems/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:241:in `block in load'
    from /home/vagrant/local/ruby/gems/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:232:in `load_dependency'
    from /home/vagrant/local/ruby/gems/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:241:in `load'
    from /usr/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /usr/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from -e:1:in `<main>'irb(main):002:0>
  • 2

    Gone. Missing rake db:migrate worth

  • @Andrey It worked. Put as an answer to give as right.

1 answer

1


The message means:

Could not find table "users."

It is possible that you created the template but forgot to run the migration. Try running:

rake db:migrate

Browser other questions tagged

You are not signed in. Login or sign up in order to post.