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
如果你有問題:)任何想法