Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
448 views
in Technique[技术] by (71.8m points)

ruby on rails - Could not load 'active_record/connection_adapters/sqlite3_adapter'

I'm trying to install ROR on my notebook (Debian Wheezy 64 bit).

On first I had this issue (enter link description here ) solved by the first answer.

Now the rails server starts, but surfing on the browser at localhost:3000 I get the following error:

Could not load 'active_record/connection_adapters/sqlite3_adapter'. Make sure that the adapter in config/database.yml is valid. If you use an adapter other than 'mysql', 'mysql2', 'postgresql' or 'sqlite3' add the necessary adapter gem to the Gemfile.

I've installed ruby 2.0.0 compiling the source code, no errors or mistakes. Then I've installed some needed libraries (sqlite3, libsqlite3-dev )...

Here is my GemFile:

'https://rubygems.org'

-# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.0'

-# Use sqlite3 as the database for Active Record
gem 'sqlite3'

-# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.0'

-# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'

-# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'

-# See https://github.com/sstephenson/execjs#readme for more supported runtimes
-# gem 'therubyracer', platforms: :ruby

-# Use jquery as the JavaScript library
gem 'jquery-rails'

-# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'

-# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 1.2'

group :doc do
  -# bundle exec rake doc:rails generates the API under doc/api.
  gem 'sdoc', require: false
end

-# Use ActiveModel has_secure_password
-# gem 'bcrypt-ruby', '~> 3.0.0'

-# Use unicorn as the app server
-# gem 'unicorn'

-# Use Capistrano for deployment
-# gem 'capistrano', group: :development

-# Use debugger
-# gem 'debugger', group: [:development, :test]

gem 'execjs'
gem 'therubyracer'

And in my 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

My gem version:

ruby 2.0.0
rails 4.0.0
sqlite 1.3.7
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Came across this error playing around in Sinatra today when running rake db:create_migration. My error was erroneously specifying a "sqlite:" database type in app.rb when it should have been "sqlite 3 :". Example:

wrong:

set :database, 'sqlite:name.db'

correct:

set :database, 'sqlite3:name.db'

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...