mongo_mapper-unstable 2010.07.02 → 2010.07.05
Sign up to get free protection for your applications and to get access to all the features.
- data/examples/keys.rb +3 -0
- metadata +3 -3
data/examples/keys.rb
CHANGED
@@ -13,6 +13,7 @@ class User
|
|
13
13
|
key :age, Integer
|
14
14
|
key :skills, Array
|
15
15
|
key :friend_ids, Array, :typecast => 'ObjectId'
|
16
|
+
key :links, Hash
|
16
17
|
timestamps!
|
17
18
|
end
|
18
19
|
User.collection.remove # empties collection
|
@@ -22,6 +23,7 @@ john = User.create({
|
|
22
23
|
:last_name => 'Nunemaker',
|
23
24
|
:age => 28,
|
24
25
|
:skills => ['ruby', 'mongo', 'javascript'],
|
26
|
+
:links => {"Google" => "http://www.google.com"}
|
25
27
|
})
|
26
28
|
|
27
29
|
steve = User.create({
|
@@ -32,6 +34,7 @@ steve = User.create({
|
|
32
34
|
})
|
33
35
|
|
34
36
|
john.friend_ids << steve.id.to_s # will get typecast to ObjectId
|
37
|
+
john.links["Ruby on Rails"] = "http://www.rubyonrails.com"
|
35
38
|
john.save
|
36
39
|
|
37
40
|
pp john
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 2010
|
7
7
|
- 7
|
8
|
-
-
|
9
|
-
version: 2010.07.
|
8
|
+
- 5
|
9
|
+
version: 2010.07.05
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- John Nunemaker
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-07-
|
17
|
+
date: 2010-07-05 00:00:00 -05:00
|
18
18
|
default_executable: mmconsole
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|