Module: MongoMapper::Plugins::Rails::ClassMethods

Defined in:
lib/mongo_mapper/plugins/rails.rb

Instance Method Summary collapse

Instance Method Details

#column_namesObject



45
46
47
# File 'lib/mongo_mapper/plugins/rails.rb', line 45

def column_names
  keys.keys
end

#has_many(*args, &extension) ⇒ Object



41
42
43
# File 'lib/mongo_mapper/plugins/rails.rb', line 41

def has_many(*args, &extension)
  many(*args, &extension)
end

#has_one(*args) ⇒ Object



37
38
39
# File 'lib/mongo_mapper/plugins/rails.rb', line 37

def has_one(*args)
  one(*args)
end

#reflect_on_association(name) ⇒ Object

Returns returns an ActiveRecordAssociationAdapter for an association. This adapter has an API that is a subset of ActiveRecord::Reflection::AssociationReflection. This allows MongoMapper to be used with the association helpers in gems like simple_form and formtastic.



52
53
54
# File 'lib/mongo_mapper/plugins/rails.rb', line 52

def reflect_on_association(name)
  ActiveRecordAssociationAdapter.for_association(associations[name]) if associations[name]
end