2016-08-08 46 views
0

當我試圖進入我的表Task的數據IRB我已經得到了錯誤:未初始化的常數表DataMapper的西納特拉和

​​

我與西納特拉工作,我用的DataMapper的數據庫。

require "sinatra" 
require 'haml' 
require 'data_mapper' 


get "/" do 
    @posts = Post.all 
    haml :index 
end 

DataMapper.setup(:default, ENV['DATABASE_URL'] || "sqlite3://#{Dir.pwd}/development.db") 

class Post 
    include DataMapper::Resource 
    property :title,   String 
    property :content,   String 
    property :photo,   String 
    property :rating,   Serial 
end 

DataMapper.finalize 

如果你有問題:)任何想法

回答

0

最後出現錯誤東陽我忘了require './main.rbPost.auto_migrate!在IRB