Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4b618f8
commit f58e0dc
Showing
6 changed files
with
49 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
0.3.5 | ||
0.3.6 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
require 'mongoid' | ||
|
||
module Mongoid | ||
module Document | ||
module PickleAdapter | ||
include Pickle::Adapter::Base | ||
|
||
# Do not consider these to be part of the class list | ||
def self.except_classes | ||
@@except_classes ||= [] | ||
end | ||
|
||
# Gets a list of the available models for this adapter | ||
def self.model_classes | ||
ObjectSpace.each_object(Class).to_a.select {|klass| klass.ancestors.include? Mongoid::Document} | ||
end | ||
|
||
# get a list of column names for a given class | ||
def self.column_names(klass) | ||
klass.fields.keys | ||
end | ||
|
||
# Get an instance by id of the model | ||
def self.get_model(klass, id) | ||
klass.find(id) | ||
end | ||
|
||
# Find the first instance matching conditions | ||
def self.find_first_model(klass, conditions) | ||
klass.first(conditions) | ||
end | ||
|
||
# Find all models matching conditions | ||
def self.find_all_models(klass, conditions) | ||
klass.all(conditions) | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters