Sha256: 04686754594389fcbe776c5ae0e8c20291591063155b2a036dad24fa42680cab

Contents?: true

Size: 852 Bytes

Versions: 1

Compression:

Stored size: 852 Bytes

Contents

module MongoMapper
  module Plugins
    module Rails
      extend ActiveSupport::Concern
      module InstanceMethods
        def to_param
          id.to_s
        end
        
        def new_record?
          new?
        end
        
        def read_attribute(name)
          self[name]
        end
        
        def read_attribute_before_typecast(name)
          read_key_before_typecast(name)
        end
        
        def write_attribute(name, value)
          self[name] = value
        end
      end
      
      module ClassMethods
        def has_one(*args)
          one(*args)
        end
        
        def has_many(*args)
          many(*args)
        end
        
        def column_names
          keys.keys
        end
        
        def human
          self.name.demodulize.titleize
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mongo_mapper-rails3-0.7.0.1 lib/mongo_mapper/plugins/rails.rb