Sha256: e984e060f3b24ddb83ce8c5a0d1ce1723a73328f28f8f7a0fe4f678c2335ff4f

Contents?: true

Size: 606 Bytes

Versions: 1

Compression:

Stored size: 606 Bytes

Contents

require 'rubygems'
require 'dm-core'
require 'yaml'
require 'logger'

# use DataMapper
# 
# class Story < Capcode::Base
#   include Capcode::Base
#   property :id, Integer, :serial => true
#   property :title, String
#   property :body, String
#   property :date, String
# end
module Capcode
  class Base
    include DataMapper::Resource
  end
  
  class << self
    def db_connect( dbfile, logfile ) #:nodoc:
      dbconfig = YAML::load(File.open(dbfile)).keys_to_sym
      DataMapper.setup(:default, dbconfig)
      DataMapper::Logger.new(logfile, :debug)
      DataMapper.auto_upgrade!
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
Capcode-0.7.0 lib/capcode/base/dm.rb