简体   繁体   中英

Ruby on Rails on Ubuntu linux: creating a new class throws db error

I am a novice linux user trying to come to terms with *nix development using Ruby on Rails. I am reading an excellent book titled "Simply Rails 2" [SitePoint:lenz] and haven't had any problem until I try to create a new Story object within the rails console and I get a "no driver for sqlite3 found" error:

$sudo ruby script/console Loading development environment (Rails 2.3.2)

class Story < ActiveRecord::Base end => nil story = Story.new RuntimeError: no driver for sqlite3 found from /usr/local/lib/ruby/gems/1.9.0/gems/sqlite3-ruby-1.2.4/lib/sqlite3/database.rb:621:in 'load_driver'...

I think it may have someting to do with where I installed the Ruby components.
I installed these folders on my desktop:

ruby-1.9.0-5 rubygems-1.3.1 sqlite-3.6.11

I'm pretty sure this is a configuration/installation issue but I'm so lost when it comes to Linux and would so appreciate any help.

Try:

gem install sqlite3-ruby

I can only recommend to install gem via your distribution package manager (aptitude/apt-get on Debian, yum on Fedora, ...) and then install everything via gem itself.

gem install rails

This should include the sqlite driver.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM