我正在启动我的第一个Sinatra应用程序,我正在尝试使用DataMapper.一切都处于很早的阶段,因为我无法实际创建数据库.当我尝试访问我的页面时,我得到“LoadError:没有这样的文件加载 – dm-sqlite-adapter”.
以下是我的Sinatra App的代码:
- 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!
我有宝石安装,作为宝石列表输出:
- *** 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)
任何建议/洞察总是赞赏.
解决方法
我没有看到该列表中的
dm-sqlite-adapter宝石.尝试安装它.