mongo_doc 0.6.10 → 0.6.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.textile +1 -1
- data/VERSION +1 -1
- data/lib/mongo_doc/document.rb +5 -2
- data/lib/mongo_doc/finders.rb +2 -1
- data/lib/mongo_doc.rb +1 -1
- data/mongo_doc.gemspec +2 -2
- data/spec/criteria_spec.rb +0 -3
- data/spec/document_spec.rb +1 -1
- metadata +4 -4
data/README.textile
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.6.
|
1
|
+
0.6.11
|
data/lib/mongo_doc/document.rb
CHANGED
@@ -101,14 +101,17 @@ module MongoDoc
|
|
101
101
|
end
|
102
102
|
end
|
103
103
|
|
104
|
+
def to_key
|
105
|
+
persisted? ? [_id] : nil
|
106
|
+
end
|
107
|
+
|
104
108
|
def to_model
|
105
109
|
self
|
106
110
|
end
|
107
111
|
|
108
112
|
def to_param
|
109
|
-
|
113
|
+
persisted? ? _id.to_s : nil
|
110
114
|
end
|
111
|
-
alias to_key to_param
|
112
115
|
|
113
116
|
def update_attributes(attrs)
|
114
117
|
self.attributes = attrs
|
data/lib/mongo_doc/finders.rb
CHANGED
@@ -25,7 +25,8 @@ module MongoDoc
|
|
25
25
|
# or conditions
|
26
26
|
#
|
27
27
|
# <tt>Person.find_one('1')</tt>
|
28
|
-
# <tt>Person.find_one(:
|
28
|
+
# <tt>Person.find_one(:conditions => {:age.gt => 25}, :order_by => [[:name,
|
29
|
+
# :asc]])</tt>
|
29
30
|
def find_one(conditions_or_id)
|
30
31
|
if Hash === conditions_or_id
|
31
32
|
Mongoid::Criteria.translate(self, conditions_or_id).one
|
data/lib/mongo_doc.rb
CHANGED
data/mongo_doc.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{mongo_doc}
|
8
|
-
s.version = "0.6.
|
8
|
+
s.version = "0.6.11"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Les Hill"]
|
12
|
-
s.date = %q{2010-07-
|
12
|
+
s.date = %q{2010-07-17}
|
13
13
|
s.description = %q{ODM for MongoDB}
|
14
14
|
s.email = %q{leshill@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
data/spec/criteria_spec.rb
CHANGED
data/spec/document_spec.rb
CHANGED
@@ -43,7 +43,7 @@ describe "MongoDoc::Document" do
|
|
43
43
|
it { should be_persisted }
|
44
44
|
its(:id) { should == doc._id }
|
45
45
|
its(:to_param) { should == doc._id.to_s }
|
46
|
-
its(:to_key) { should == doc._id
|
46
|
+
its(:to_key) { should == [doc._id] }
|
47
47
|
end
|
48
48
|
|
49
49
|
context "record has not been persisted" do
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mongo_doc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 17
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 6
|
9
|
-
-
|
10
|
-
version: 0.6.
|
9
|
+
- 11
|
10
|
+
version: 0.6.11
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Les Hill
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-07-
|
18
|
+
date: 2010-07-17 00:00:00 -04:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|