Sha256: f3c1d93645050de5698aca62e5c94e4c96dca4298cad132068484ef371eeb478
Contents?: true
Size: 599 Bytes
Versions: 27
Compression:
Stored size: 599 Bytes
Contents
class ImageField #include Mongoid::Fields::Serializable class << self # Get the object as it was stored in the database, and instantiate # this custom class from it. def demongoize(object) Image.find(object).file end # Takes any possible object and converts it to how it would be # stored in the database. def mongoize(object) case object when BSON::ObjectId then object else BSON::ObjectId(object) end end # Converts the object that was supplied to a criteria and converts it # into a database friendly form. end end
Version data entries
27 entries across 27 versions & 1 rubygems