开发者

No gem called "activerecord-sqlite3-ruby-adapter"

I am trying to set up active records on top of a sqlite3 database with native ruby 1.8. This should work easily enough, I have seen plenty of examples out there that explain how. I am using some example code I have found, its pretty basic and starts with the following lines:

require 'rubygems'
require 'active_record'
#require 'sqlite3-ruby'

...

ActiveRecord::Base.establish_connection(
    :adapter => "sqlite3-ruby",
    #:dbfile  => ":memory:"
    :database  => ":memory:"
    #:database  => "/home/fgysin/bender/gen2/metaDB/testing/sql3.db"
)

ActiveRecord::Schema.define do  
  create_table :albums do |table|
    table.column :title, :string
    table.column :performer, :string
  end

  create_table :tracks do |table|
    table.column :album_id, :integer
    table.column :track_number, :integer
    table.column :title, :string
  end
end

But when I run this example (it would create some tables and print some simple stats) I get the following error:

/var/lib/gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/connection_specification.rb:
76:in `establish_connection':
Please install t开发者_StackOverflow中文版he sqlite3-ruby adapter:
`gem install activerecord-sqlite3-ruby-adapter`

(no such file to load -- active_record/connection_adapters/sqlite3-ruby_adapter) (RuntimeError)
from 2nd.generation/ActiveRecordExample.rb:8

I tried installing that activerecord-sqlite... gem but it is not found anywhere. I searched with google and it got me no hits on that gem name either.

The following gems related with sqlite/activerecords are installed:

(I installed 'activerecord', 'sqlite3-ruby' and 'activerecord-jdbcsqlite3-adapter' allthoug the latter would be used for JRuby...)

activerecord (2.3.5, 2.3.4, 2.2.2, 2.1.0)
activerecord-jdbc-adapter (0.9.2)
activerecord-jdbcsqlite3-adapter (0.9.2)
sqlite3-ruby (1.2.5)
dbd-sqlite3 (1.2.5)
jdbc-sqlite3 (3.6.3.054)

Can anyone please suggest a solution to my problem? I really do not see how I can find/install the needed adapter for sqlite3/activerecords. How is it called? It is obviously not the adapter that is suggested by the error message as it is not found locally or in a repository...


Just a shot in the dark, but did you try changing:

:adapter => "sqlite3-ruby",

to

:adapter => "sqlite3",

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜