Keva161
Keva161

Reputation: 2683

Data mapper not working (uninitialized constant)

I'm playing around with Sinatra and following a simple tutorial I found online ( http://carlosgabaldon.com/articles/singing-with-sinatra/).

The thing is though, every time I try to enter DataMapper::Database.setup({...

I get uninitialized constant DataMapper::Database (NameError).. Any ideas why?

Upvotes: 1

Views: 2312

Answers (2)

Gaston
Gaston

Reputation: 41

I had that same issue doing the tutorial on Sinatra/DataMapper on RubySource.

The problem was that I wan't calling

require 'dm-sqlite-adapter'

Upvotes: 4

Paul Hoffer
Paul Hoffer

Reputation: 12906

Like others said, you should definitely use some newer/better tutorials. The Getting Started page on DataMapper's website is a good starting point, along with the rest of their docs.

To answer your question, this should connect to your database:

DataMapper.setup(:default, 'sqlite://db/my_way_development')

Upvotes: 1

Related Questions