Created
February 20, 2010 10:02
-
-
Save nmk/309616 to your computer and use it in GitHub Desktop.
This file contains 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
require 'pp' | |
require 'rubygems' | |
require 'mongo_mapper' | |
MongoMapper.database = 'testing' | |
class Party | |
include MongoMapper::Document | |
key :happens_on, Time, :default => Date.today.to_time | |
end | |
party = Party.new | |
pp party.happens_on # => Sat Feb 20 00:00:00 +0100 2010 | |
party.save | |
pp party.happens_on # => Sat Feb 20 00:00:00 +0100 2010 | |
party.happens_on = Date.today.to_time | |
party.save | |
pp party.happens_on # => Fri Feb 19 23:00:00 UTC 2010 | |
party.update_attributes(:happens_on => Date.today.to_time) | |
pp party.happens_on # => Fri Feb 19 23:00:00 UTC 2010 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment