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

Version Path
classiccms-0.7.5 lib/classiccms/custom.rb
classiccms-0.7.4 lib/classiccms/custom.rb
classiccms-0.7.3 lib/classiccms/custom.rb
classiccms-0.7.2 lib/classiccms/custom.rb
classiccms-0.7.1 lib/classiccms/custom.rb
classiccms-0.7.0 lib/classiccms/custom.rb
classiccms-0.6.9 lib/classiccms/custom.rb
classiccms-0.6.8 lib/classiccms/custom.rb
classiccms-0.6.7 lib/classiccms/custom.rb
classiccms-0.6.6 lib/classiccms/custom.rb
classiccms-0.6.5 lib/classiccms/custom.rb
classiccms-0.6.4 lib/classiccms/custom.rb
classiccms-0.6.3 lib/classiccms/custom.rb
classiccms-0.6.2 lib/classiccms/custom.rb
classiccms-0.6.1 lib/classiccms/custom.rb
classiccms-0.6.0 lib/classiccms/custom.rb
classiccms-0.5.17 lib/classiccms/custom.rb
classiccms-0.5.16 lib/classiccms/custom.rb
classiccms-0.5.15 lib/classiccms/custom.rb
classiccms-0.5.14 lib/classiccms/custom.rb