Module: MongoMapper::EmbeddedDocument::PickleAdapter
- Includes:
- Pickle::Adapter::Base
- Defined in:
- lib/pickle/adapters/mongo_mapper.rb
Class Method Summary collapse
-
.column_names(klass) ⇒ Object
get a list of column names for a given class.
-
.except_classes ⇒ Object
Do not consider these to be part of the class list.
-
.find_all_models(klass, conditions) ⇒ Object
Find all models matching conditions.
-
.find_first_model(klass, conditions) ⇒ Object
Find the first instance matching conditions.
-
.get_model(klass, id) ⇒ Object
Get an instance by id of the model.
-
.model_classes ⇒ Object
Gets a list of the available models for this adapter.
Class Method Details
.column_names(klass) ⇒ Object
get a list of column names for a given class
59 60 61 62 |
# File 'lib/pickle/adapters/mongo_mapper.rb', line 59 def self.column_names(klass) #klass.column_names klass.keys.keys end |
.except_classes ⇒ Object
Do not consider these to be part of the class list
49 50 51 |
# File 'lib/pickle/adapters/mongo_mapper.rb', line 49 def self.except_classes @@except_classes ||= [] end |
.find_all_models(klass, conditions) ⇒ Object
Find all models matching conditions
75 76 77 |
# File 'lib/pickle/adapters/mongo_mapper.rb', line 75 def self.find_all_models(klass, conditions) klass.all(:conditions => conditions) end |
.find_first_model(klass, conditions) ⇒ Object
Find the first instance matching conditions
70 71 72 |
# File 'lib/pickle/adapters/mongo_mapper.rb', line 70 def self.find_first_model(klass, conditions) klass.first(conditions) end |
.get_model(klass, id) ⇒ Object
Get an instance by id of the model
65 66 67 |
# File 'lib/pickle/adapters/mongo_mapper.rb', line 65 def self.get_model(klass, id) klass.find(id) end |
.model_classes ⇒ Object
Gets a list of the available models for this adapter
54 55 56 |
# File 'lib/pickle/adapters/mongo_mapper.rb', line 54 def self.model_classes @@model_classes ||= ObjectSpace.each_object(Class).select {|klass| klass.ancestors.include?(MongoMapper::Document) || klass.ancestors.include?(MongoMapper::EmbeddedDocument)} end |