2014-01-20 116 views
1

我剛剛開始了Michael Hartl的Ruby on Rails教程,並且遇到了運行我的第一個rails服務器的問題。而不是正常的默認應用程序頁面,我收到ActiveRecord :: ConnectionNotE已建立的錯誤,我一直無法解決。ActiveRecord :: ConnectionNotEstablished在Ruby on Rails上設置第一個rails應用程序教程

我的Gemfile

source 'https://rubygems.org' 
gem 'rails', '3.2.16' 
group :development do 
gem 'sqlite3', '1.3.5' 
end 
group :assets do 
gem 'sass-rails', '3.2.5' 
gem 'coffee-rails', '3.2.2' 
gem 'uglifier', '1.2.3' 
end 
gem 'jquery-rails', '2.0.2' 

我的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 

完整曲線

activerecord (3.2.16) lib/active_record/connection_adapters/abstract/connection_pool.rb:410:in `retrieve_connection' 
activerecord (3.2.16) lib/active_record/connection_adapters/abstract/connection_specification.rb:171:in `retrieve_connection' 
activerecord (3.2.16) lib/active_record/connection_adapters/abstract/connection_specification.rb:145:in `connection' 
activerecord (3.2.16) lib/active_record/query_cache.rb:67:in `rescue in call' 
activerecord (3.2.16) lib/active_record/query_cache.rb:61:in `call' 
activerecord (3.2.16) lib/active_record/connection_adapters/abstract/connection_pool.rb:479:in `call' 
actionpack (3.2.16) lib/action_dispatch/middleware/callbacks.rb:28:in `block in call' 
activesupport (3.2.16) lib/active_support/callbacks.rb:405:in `_run__105514737__call__333040863__callbacks' 
activesupport (3.2.16) lib/active_support/callbacks.rb:405:in `__run_callback' 
activesupport (3.2.16) lib/active_support/callbacks.rb:385:in `_run_call_callbacks' 
activesupport (3.2.16) lib/active_support/callbacks.rb:81:in `run_callbacks' 
actionpack (3.2.16) lib/action_dispatch/middleware/callbacks.rb:27:in `call' 
actionpack (3.2.16) lib/action_dispatch/middleware/reloader.rb:65:in `call' 
actionpack (3.2.16) lib/action_dispatch/middleware/remote_ip.rb:31:in `call' 
actionpack (3.2.16) lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call' 
actionpack (3.2.16) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call' 
railties (3.2.16) lib/rails/rack/logger.rb:32:in `call_app' 
railties (3.2.16) lib/rails/rack/logger.rb:16:in `block in call' 
activesupport (3.2.16) lib/active_support/tagged_logging.rb:22:in `tagged' 
railties (3.2.16) lib/rails/rack/logger.rb:16:in `call' 
actionpack (3.2.16) lib/action_dispatch/middleware/request_id.rb:22:in `call' 
rack (1.4.5) lib/rack/methodoverride.rb:21:in `call' 
rack (1.4.5) lib/rack/runtime.rb:17:in `call' 
activesupport (3.2.16) lib/active_support/cache/strategy/local_cache.rb:72:in `call' 
rack (1.4.5) lib/rack/lock.rb:15:in `call' 
actionpack (3.2.16) lib/action_dispatch/middleware/static.rb:63:in `call' 
railties (3.2.16) lib/rails/engine.rb:484:in `call' 
railties (3.2.16) lib/rails/application.rb:231:in `call' 
rack (1.4.5) lib/rack/content_length.rb:14:in `call' 
railties (3.2.16) lib/rails/rack/log_tailer.rb:17:in `call' 
rack (1.4.5) lib/rack/handler/webrick.rb:59:in `service' 
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/webrick/httpserver.rb:138:in `service' 
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/webrick/httpserver.rb:94:in `run' 
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/webrick/server.rb:191:in `block in start_thread' 

完整曲線做的最多的建議後:

activerecord (3.2.16) lib/active_record/connection_adapters/abstract/connection_pool.rb:410:in `retrieve_connection' 
activerecord (3.2.16) lib/active_record/connection_adapters/abstract/connection_specification.rb:171:in `retrieve_connection' 
activerecord (3.2.16) lib/active_record/connection_adapters/abstract/connection_specification.rb:145:in `connection' 
activerecord (3.2.16) lib/active_record/query_cache.rb:67:in `rescue in call' 
activerecord (3.2.16) lib/active_record/query_cache.rb:61:in `call' 
activerecord (3.2.16) lib/active_record/connection_adapters/abstract/connection_pool.rb:479:in `call' 
actionpack (3.2.16) lib/action_dispatch/middleware/callbacks.rb:28:in `block in call' 
activesupport (3.2.16) lib/active_support/callbacks.rb:405:in `_run__733682894__call__567347261__callbacks' 
activesupport (3.2.16) lib/active_support/callbacks.rb:405:in `__run_callback' 
activesupport (3.2.16) lib/active_support/callbacks.rb:385:in `_run_call_callbacks' 
activesupport (3.2.16) lib/active_support/callbacks.rb:81:in `run_callbacks' 
actionpack (3.2.16) lib/action_dispatch/middleware/callbacks.rb:27:in `call' 
actionpack (3.2.16) lib/action_dispatch/middleware/reloader.rb:65:in `call' 
actionpack (3.2.16) lib/action_dispatch/middleware/remote_ip.rb:31:in `call' 
actionpack (3.2.16) lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call' 
actionpack (3.2.16) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call' 
railties (3.2.16) lib/rails/rack/logger.rb:32:in `call_app' 
railties (3.2.16) lib/rails/rack/logger.rb:16:in `block in call' 
activesupport (3.2.16) lib/active_support/tagged_logging.rb:22:in `tagged' 
railties (3.2.16) lib/rails/rack/logger.rb:16:in `call' 
actionpack (3.2.16) lib/action_dispatch/middleware/request_id.rb:22:in `call' 
rack (1.4.5) lib/rack/methodoverride.rb:21:in `call' 
rack (1.4.5) lib/rack/runtime.rb:17:in `call' 
activesupport (3.2.16) lib/active_support/cache/strategy/local_cache.rb:72:in `call' 
rack (1.4.5) lib/rack/lock.rb:15:in `call' 
actionpack (3.2.16) lib/action_dispatch/middleware/static.rb:63:in `call' 
railties (3.2.16) lib/rails/engine.rb:484:in `call' 
railties (3.2.16) lib/rails/application.rb:231:in `call' 
rack (1.4.5) lib/rack/content_length.rb:14:in `call' 
railties (3.2.16) lib/rails/rack/log_tailer.rb:17:in `call' 
rack (1.4.5) lib/rack/handler/webrick.rb:59:in `service' 
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/webrick/httpserver.rb:138:in `service' 
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/webrick/httpserver.rb:94:in `run' 
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/webrick/server.rb:191:in `block in start_thread' 
+0

兩件事:1.嘗試將'gem'sqlite3','1.3.5''改爲'gem'sqlite3'',2.嘗試將'gem'sqlite3''移出:開發組(將其放在上面) – Max

+0

嘿馬克斯沒有工作。獲得相同的錯誤 – jonchiehlau

+0

也是,你正在學習的這個教程在哪裏?只是這樣我才能更好地幫助 – Max

回答

0

有沒有要連接的數據庫呢,我想。運行rake db:create

+0

不,我試着從查看其他答案。它告訴我我的分貝已經存在 – jonchiehlau