Sha256: 2c0e04b5f3de3dab3ec4961f3a3f3b8c532926bbd187ad24f83b4ce87145acc7

Contents?: true

Size: 529 Bytes

Versions: 10

Compression:

Stored size: 529 Bytes

Contents

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

        class << model
          alias has_many many
          alias has_one one
        end
      end

      module ClassMethods
        def column_names
          keys.keys
        end
        
        def human_name
          self.name.demodulize.titleize
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 4 rubygems

Version Path
mrkurt-mongo_mapper-0.6.11 lib/mongo_mapper/rails_compatibility/embedded_document.rb
mongo_mapper-unstable-2010.1.6 lib/mongo_mapper/rails_compatibility/embedded_document.rb
mongo_mapper-unstable-2010.1.5 lib/mongo_mapper/rails_compatibility/embedded_document.rb
mongo_mapper-unstable-2010.1.4 lib/mongo_mapper/rails_compatibility/embedded_document.rb
tpitale-mongo_mapper-0.6.10 lib/mongo_mapper/rails_compatibility/embedded_document.rb
mrkurt-mongo_mapper-0.6.10 lib/mongo_mapper/rails_compatibility/embedded_document.rb
mongo_mapper-0.6.10 lib/mongo_mapper/rails_compatibility/embedded_document.rb
mrkurt-mongo_mapper-0.6.9 lib/mongo_mapper/rails_compatibility/embedded_document.rb
mongo_mapper-0.6.9 lib/mongo_mapper/rails_compatibility/embedded_document.rb
mrkurt-mongo_mapper-0.6.8 lib/mongo_mapper/rails_compatibility/embedded_document.rb