Created
December 2, 2010 05:59
-
-
Save krishna-shilpakar/724847 to your computer and use it in GitHub Desktop.
example_model
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
class Person | |
include Mongoid::Document | |
field :name, :type => String | |
field :age, :type => Integer | |
field :address, :type => Hash | |
end | |
/***** ADDING THROUGH CONSOLE ******/ | |
p = Person.create(:name => 'John warden', :age => 30, :address => {:city => 'city, :street => 'street'}) // this will create a record in DB | |
/****** USING PICKLE *********/ | |
Given a person exist with name: "John warden", age: 30, address: {:city => 'city', :street => 'street'} | |
// It doesn't find any pickle steps rather it say no step defined. | |
Note: address is not embedded or referenced document, It is a field in a person with type Hash. I do know we could embed address, so it only the example. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment