Sha256: 8f3de36fefd640e8e7f207177bb6902b945e2e7717844817d2820df5c5b9972b

Contents?: true

Size: 507 Bytes

Versions: 4

Compression:

Stored size: 507 Bytes

Contents

module MongoMapper
  module EmbeddedDocumentRailsCompatibility
    def self.included(model)
      model.class_eval do
        extend ClassMethods
      end
      class << model
        alias_method :has_many, :many
      end
    end

    module ClassMethods
      def column_names
        keys.keys
      end
    end

    def to_param
      raise "Missing to_param method in #{self.class.name}. You should implement it to return the unique identifier of this document within a collection."
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
fcoury-mongomapper-0.2.0 lib/mongomapper/embedded_document_rails_compatibility.rb
fcoury-mongomapper-0.3.4 lib/mongomapper/embedded_document_rails_compatibility.rb
fcoury-mongomapper-0.3.5 lib/mongomapper/embedded_document_rails_compatibility.rb
fcoury-mongomapper-0.4.0 lib/mongomapper/embedded_document_rails_compatibility.rb