5

I am working on a Sinatra application where I would like to use data_mapper & sqlite3. in app.rb I have:

require 'sinatra'
require 'data_mapper'

in the console when I do $ gem list I get(list somewhat edited to reflect db gems:
* LOCAL GEMS *

activemodel (4.0.2)
activerecord (4.0.2)
activerecord-deprecated_finders (1.0.3)
activesupport (4.0.2)
addressable (2.3.5)
arel (4.0.2)
atomic (1.1.14)
bcrypt-ruby (3.1.2)
bigdecimal (1.2.3)
buftok (0.2.0)
builder (3.1.4)
bundler (1.5.3)
bundler-unload (1.0.2)
cookiejar (0.3.0)
daemons (1.1.9)
data_mapper (1.2.0)
data_objects (0.10.13)
descendants_tracker (0.0.3)
dm-aggregates (1.2.0)
dm-constraints (1.2.0)
dm-core (1.2.1)
dm-do-adapter (1.2.0)
dm-migrations (1.2.0)
dm-serializer (1.2.2)
dm-sqlite-adapter (1.2.0)
dm-timestamps (1.2.0)
dm-transactions (1.2.0)
dm-types (1.2.2)
dm-validations (1.2.0)
do_sqlite3 (0.10.13)
fastercsv (1.5.5)
gem-wrappers (1.2.4)
http (0.5.0)
http_parser.rb (0.6.0)
i18n (0.6.9)
io-console (0.4.2)
json (1.8.1)
json_pure (1.8.1)
memoizable (0.4.0)
mini_portile (0.5.2)
minitest (4.7.5)
multi_json (1.8.4)
multipart-post (2.0.0)
oauth (0.4.7)
pg (0.17.1)
rack (1.5.2)
rack-protection (1.5.2)
rake (10.1.0)
rdoc (4.1.0)
rubygems-bundler (1.4.2)
rvm (1.11.3.8)
shotgun (0.9)
simple_oauth (0.2.0)
sinatra (1.4.4)
sinatra-activerecord (1.3.0)
sqlite3 (1.3.8)

when I go to irb and require data_mapper I get =>"true" However, when I got to the app through a browser I get: LoadError: cannot load such file -- data_mapper. From what I have read this problem is usually a result of require 'datamapper' instead of require 'data_mapper'. What am I doing wrong?

Kevin Brechbühl
  • 4,717
  • 3
  • 24
  • 47
FierceScarf
  • 461
  • 1
  • 5
  • 17

1 Answers1

0

Try requiring dm-sqlite-adapter says the Docster

You've got the gem but not requiring it in code. I don't know if this will fix it but in a recent project the adapter was what we needed to require explicitly in our controller.

Tam Borine
  • 1,474
  • 2
  • 13
  • 21