database_cleaner/examples/lib/mongomapper_models.rb
2010-02-18 18:37:24 -07:00

17 lines
349 B
Ruby

require 'mongomapper'
::MongoMapper.connection = Mongo::Connection.new('127.0.0.1')
::MongoMapper.database = 'database_cleaner_test'
class Widget
include MongoMapper::Document
key :id, Integer
key :name, String
class << self
#mongomapper doesn't seem to provide this...
def create!(*args)
new(*args).save!
end
end
end