Я запускаю Rails 3.2.11, но это похоже на 3.2.10 и 3.2 .9 для меня тоже. По существу, яКонсоль Rails не открывается из-за ошибки «Пожалуйста, установите ошибку postgresql», в новом созданном приложении, которое не использует postgres.
rails new sample_app
rails console
И это выплевывает:
/Users/carl/.rvm/gems/[email protected]/gems/bundler-1.2.3/lib/bundler/rubygems_integration.rb:147:in `block in replace_gem': Please install the postgresql adapter: `gem install activerecord-postgresql-adapter` (pg is not part of the bundle. Add it to Gemfile.) (LoadError)
from /Users/carl/.rvm/gems/[email protected]/gems/activerecord-3.2.11/lib/active_record/connection_adapters/postgresql_adapter.rb:7:in `<top (required)>'
from /Users/carl/.rvm/gems/[email protected]/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `require'
from /Users/carl/.rvm/gems/[email protected]/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `block in require'
from /Users/carl/.rvm/gems/[email protected]/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:236:in `load_dependency'
from /Users/carl/.rvm/gems/[email protected]/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `require'
from /Users/carl/.rvm/gems/[email protected]/gems/activerecord-3.2.11/lib/active_record/connection_adapters/abstract/connection_specification.rb:50:in `resolve_hash_connection'
from /Users/carl/.rvm/gems/[email protected]/gems/activerecord-3.2.11/lib/active_record/connection_adapters/abstract/connection_specification.rb:41:in `resolve_string_connection'
from /Users/carl/.rvm/gems/[email protected]/gems/activerecord-3.2.11/lib/active_record/connection_adapters/abstract/connection_specification.rb:27:in `spec'
from /Users/carl/.rvm/gems/[email protected]/gems/activerecord-3.2.11/lib/active_record/connection_adapters/abstract/connection_specification.rb:130:in `establish_connection'
from /Users/carl/.rvm/gems/[email protected]/gems/activerecord-3.2.11/lib/active_record/railtie.rb:82:in `block (2 levels) in <class:Railtie>'
from /Users/carl/.rvm/gems/[email protected]/gems/activesupport-3.2.11/lib/active_support/lazy_load_hooks.rb:36:in `instance_eval'
from /Users/carl/.rvm/gems/[email protected]/gems/activesupport-3.2.11/lib/active_support/lazy_load_hooks.rb:36:in `execute_hook'
from /Users/carl/.rvm/gems/[email protected]/gems/activesupport-3.2.11/lib/active_support/lazy_load_hooks.rb:43:in `block in run_load_hooks'
from /Users/carl/.rvm/gems/[email protected]/gems/activesupport-3.2.11/lib/active_support/lazy_load_hooks.rb:42:in `each'
from /Users/carl/.rvm/gems/[email protected]/gems/activesupport-3.2.11/lib/active_support/lazy_load_hooks.rb:42:in `run_load_hooks'
from /Users/carl/.rvm/gems/[email protected]/gems/activerecord-3.2.11/lib/active_record/base.rb:720:in `<top (required)>'
from /Users/carl/.rvm/gems/[email protected]/gems/activerecord-3.2.11/lib/active_record/railtie.rb:41:in `block in <class:Railtie>'
from /Users/carl/.rvm/gems/[email protected]/gems/railties-3.2.11/lib/rails/railtie.rb:179:in `call'
from /Users/carl/.rvm/gems/[email protected]/gems/railties-3.2.11/lib/rails/railtie.rb:179:in `block in load_console'
from /Users/carl/.rvm/gems/[email protected]/gems/railties-3.2.11/lib/rails/railtie.rb:179:in `each'
from /Users/carl/.rvm/gems/[email protected]/gems/railties-3.2.11/lib/rails/railtie.rb:179:in `load_console'
from /Users/carl/.rvm/gems/[email protected]/gems/railties-3.2.11/lib/rails/engine.rb:429:in `block in load_console'
from /Users/carl/.rvm/gems/[email protected]/gems/railties-3.2.11/lib/rails/application/railties.rb:8:in `each'
from /Users/carl/.rvm/gems/[email protected]/gems/railties-3.2.11/lib/rails/application/railties.rb:8:in `all'
from /Users/carl/.rvm/gems/[email protected]/gems/railties-3.2.11/lib/rails/engine.rb:429:in `load_console'
from /Users/carl/.rvm/gems/[email protected]/gems/railties-3.2.11/lib/rails/application.rb:153:in `load_console'
from /Users/carl/.rvm/gems/[email protected]/gems/railties-3.2.11/lib/rails/commands/console.rb:27:in `start'
from /Users/carl/.rvm/gems/[email protected]/gems/railties-3.2.11/lib/rails/commands/console.rb:8:in `start'
from /Users/carl/.rvm/gems/[email protected]/gems/railties-3.2.11/lib/rails/commands.rb:41:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
Мой вопрос: Я использую по умолчанию генерируется Gemfile и даже не используя Postgres. Почему Rails жалуется на меня и как я могу это исправить? Может ли это быть чем-то связанным с моим gemset или RubyGems? Вот Gemfile для справки:
source 'https://rubygems.org'
gem 'rails', '3.2.11'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'sqlite3'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', :platforms => :ruby
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'
# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'
# To use Jbuilder templates for JSON
# gem 'jbuilder'
# Use unicorn as the app server
# gem 'unicorn'
# Deploy with Capistrano
# gem 'capistrano'
# To use debugger
# gem 'debugger'
Это мой database.yml:
# SQLite version 3.x
# gem install sqlite3
#
# Ensure the SQLite 3 gem is defined in your Gemfile
# gem 'sqlite3'
development:
adapter: sqlite3
database: db/development.sqlite3
pool: 5
timeout: 5000
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
adapter: sqlite3
database: db/test.sqlite3
pool: 5
timeout: 5000
production:
adapter: sqlite3
database: db/production.sqlite3
pool: 5
timeout: 5000
Привет, спасибо, что ответили - я обновил свой вопрос с файлом; это все sqlite3, как и должно быть. –
Можете ли вы подтолкнуть это к github, чтобы я мог взглянуть - я не могу воспроизвести вашу проблему. – qnm
Конечно! Он находится по адресу https://github.com/carlgao/sample-app-4. Огромное спасибо :) –