开发者

LoadError: no such file to load -- dm-sqlite-adapter

I'm starting my first Sinatra App and I'm trying to use DataMapper. Everything is in the very early stages, as I can't get it to actually create the DB. I get "LoadError: no such file to load -- dm-sqlite-adapter" when I try to visit my page.

Here's the code from my Sinatra App so far:

require 'rubygems'
require 'sinatra'
require 'dm-core'
require 'dm-timestamps'
# Also tried require 'datamapper' , but the same issue shows up

DataMapper::setup(:default, "sqlite3://#{Dir.pwd}/raffle.db")

class Raffle 
    include DataMapper::Resource

    property :id,           Serial
    property :firstName,    String
    property :lastName,     String
    property :email,        String
    property :created_at,   DateTime

end

# Create, upgrade, or migrate DB Tables
DataMapper.auto_upgrade!

I have the gems installed, as gem list outputs:

*** LOCAL GEMS ***

activemodel (3.0.9, 3.0.3)
activerecord (3.0.9, 3.0.3)
activesupport (3.0.9, 3.0.3)
addressable (2.2.6)
arel (2.0.10, 2.0.4)
bcrypt-ruby (2.1.4)
builder (2.1.2)
bundler (1.0.15)
data_objects (0.10.6)
datamapper (1.1.0)
diff-lcs (1.1.2)
dm-aggregates (1.1.0)
dm-constraints (1.1.0)
dm-core (1.1.0)
dm-migrations (1.1.0)
dm-serializer (1.1.0)
dm-timestamps (1.1.0)
dm-transactions (1.1.0)
dm-types (1.1.0)
dm-validations (1.1.0)
do_sqlite3 (0.10.6)
fastercsv (1.5.4)
ffi (0.6.3)
i18n (0.5.0, 0.4.2)
json (1.5.3, 1.4.6)
mime-types (1.16)
rack (1.3.0, 1.2.1)
rack-test (0.5.6)
rake (0.8.7)
require_all (1.2.0)
rspec 开发者_运维知识库(2.6.0)
rspec-core (2.6.4)
rspec-expectations (2.6.0)
rspec-mocks (2.6.0)
shotgun (0.9)
sinatra (1.2.6, 1.1.0)
sqlite3 (0.1.1)
stringex (1.2.1)
tilt (1.3.2, 1.1)
typhoeus (0.2.4, 0.2.0)
tzinfo (0.3.29, 0.3.23)
uuidtools (2.1.2)

Any advice/insight is always appreciated.


I don't see the dm-sqlite-adapter gem in that list. Try installing it.


It may be a bit late for the original question, but in case anyone has a similar issue, putting an underscore "data_mapper" in require 'data_mapper' worked for me.


You always need to explicitly add an adapter gem to your gemfile. Even data_mapper meta gem doesn't require any of the adapters.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜