This code is failing on the last line specifically due to the check for table_exists? How do I correctly do this in Datamapper?
require 'sinatra'
require 'DataMapper'
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
DataMapper.finalize
# automatically create the post table
DataMapper.auto_migrate! unless Post.table_exists?