Created
April 15, 2010 11:00
-
-
Save solnic/366970 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby -Ku | |
# encoding: utf-8 | |
require 'rubygems' | |
require 'dm-core' | |
require 'dm-migrations' | |
require 'dm-timestamps' | |
DataMapper.setup :default, 'sqlite3::memory:' | |
class Foo | |
include DataMapper::Resource | |
property :id, Serial | |
property :name, String | |
property :created_at, DateTime | |
property :updated_at, DateTime | |
end | |
DataMapper.auto_migrate! | |
foo = Foo.create :name => 'foo' | |
puts foo.inspect # has timestamps | |
foo.reload | |
puts foo.inspect # nil timestamps | |
foo.save # nil timestamps are persisted | |
puts foo.created_at # nil | |
puts foo.updated_at # nil |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment