lib/couchpillow/document.rb in couchpillow-0.4.10 vs lib/couchpillow/document.rb in couchpillow-0.4.11
- old
+ new
@@ -21,20 +21,20 @@
type_prefix true
attribute :_created_at do
required
- type Time
+ type CouchPillow::Iso8601Time
auto_convert
- default { Time.now.utc }
+ default { CouchPillow::Iso8601Time.now.utc }
end
attribute :_updated_at do
required
- type Time
+ type CouchPillow::Iso8601Time
auto_convert
- default { Time.now.utc }
+ default { CouchPillow::Iso8601Time.now.utc }
end
# Constructor.
# @param hash The document
@@ -48,11 +48,11 @@
@data = CouchPillow.symbolize(hash)
@original = Marshal.load(Marshal.dump(@data))
@id = self.class._is_type_prefixed? ? self.class._sanitize_id(id) : id
- time = Time.now.utc
+ time = CouchPillow::Iso8601Time.now.utc
@data[:_created_at] ||= time
@data[:_updated_at] ||= time
@cas = cas
@@ -309,10 +309,10 @@
# Timestamp this document
#
def _timestamp!
- @data[:_updated_at] = Time.now.utc
+ @data[:_updated_at] = CouchPillow::Iso8601Time.now.utc
end
def _cas_handler &block
# write to the primary db first