Sha256: 677b1c81df4031db6d51769ce6c005089e454eb3e34aea98c87e0f8a1a6ca358
Contents?: true
Size: 408 Bytes
Versions: 17
Compression:
Stored size: 408 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) value.to_date 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
17 entries across 17 versions & 1 rubygems