Sha256: 34ed250126f0154576e1c09ade4fe5b1b68a293685044b0059fd5c315ebdfb04
Contents?: true
Size: 518 Bytes
Versions: 21
Compression:
Stored size: 518 Bytes
Contents
require 'active_support/core_ext/date/conversions' require 'active_support/core_ext/string/conversions' module MongoModel module Types class Date < Object def cast(value) case value when ::Array ::Date.new(*value) else value.to_date end rescue nil end def to_mongo(value) value.strftime("%Y/%m/%d") if value end def from_mongo(value) value.to_date if value end end end end
Version data entries
21 entries across 21 versions & 1 rubygems