Tuesday, May 8, 2012

ruby sinatra dm-sqlite-adapter (LoadError)

rubygems/custom_require.rb:36:in `require': cannot load such file -- dm-sqlite-adapter (LoadError)
require 'rubygems'
require 'sinatra'
require 'data_mapper' # metagem, requires common plugins too.
# need install dm-sqlite-adapter
DataMapper::setup(:default, "sqlite3://#{Dir.pwd}/blog.db")



    class Post
include DataMapper::Resource
property :id, Serial
property :title, String
property :body, Text
property :created_at, DateTime
end

# Perform basic sanity checks and initialize all relationships
# Call this when you've defined all your models
DataMapper.finalize

# automatically create the post table
Post.auto_upgrade!




No comments:

Post a Comment