Module: MongoMapper::RailsCompatibility::EmbeddedDocument

Defined in:
lib/mongomapper/rails_compatibility/embedded_document.rb

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(model) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
# File 'lib/mongomapper/rails_compatibility/embedded_document.rb', line 4

def self.included(model)
  model.class_eval do
    extend ClassMethods
    
    alias_method :new_record?, :new?
  end

  class << model
    alias has_many many
  end
end

Instance Method Details

#to_paramObject



22
23
24
# File 'lib/mongomapper/rails_compatibility/embedded_document.rb', line 22

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