Sha256: 4002cef59e38c53b9f95308973233fc6bdbca68dafc82c946ab81198f458d8fc
Contents?: true
Size: 486 Bytes
Versions: 3
Compression:
Stored size: 486 Bytes
Contents
module Popolo # A date expressed as a string. # @see http://mongoid.org/en/mongoid/docs/documents.html#custom_fields class DateString < String def mongoize self.class.mongoize(self) end class << self def demongoize(object) object.blank? ? nil : Date.parse(object) rescue object end def mongoize(object) object.blank? ? nil : object.to_s end def evolve(object) mongoize(object) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
popolo-0.1.1 | app/models/popolo/date_string.rb |
popolo-0.1.0 | app/models/popolo/date_string.rb |
popolo-0.0.3 | app/models/popolo/date_string.rb |