Skip to content

Commit

Permalink
Add hash to keys example file
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Heaton authored and jnunemaker committed Jul 5, 2010
1 parent cadd288 commit 8cd51bc
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions examples/keys.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class User
key :age, Integer
key :skills, Array
key :friend_ids, Array, :typecast => 'ObjectId'
key :links, Hash
timestamps!
end
User.collection.remove # empties collection
Expand All @@ -22,6 +23,7 @@ class User
:last_name => 'Nunemaker',
:age => 28,
:skills => ['ruby', 'mongo', 'javascript'],
:links => {"Google" => "http://www.google.com"}
})

steve = User.create({
Expand All @@ -32,6 +34,7 @@ class User
})

john.friend_ids << steve.id.to_s # will get typecast to ObjectId
john.links["Ruby on Rails"] = "http://www.rubyonrails.com"
john.save

pp john

0 comments on commit 8cd51bc

Please sign in to comment.