features/step_definitions/documents.rb in mongodoc-0.1.2 vs features/step_definitions/documents.rb in mongodoc-0.2.0
- old
+ new
@@ -1,19 +1,30 @@
-class Address < MongoDoc::Document
+class Address
+ include MongoDoc::Document
+
key :street
key :city
key :state
key :zip_code
end
-class Place < MongoDoc::Document
+class Place
+ include MongoDoc::Document
+
key :name
key :type
has_one :address
end
-class Contact < MongoDoc::Document
+class Contact
+ include MongoDoc::Document
+
key :name
key :type
+ key :note
key :interests
has_many :addresses
+
+ named_scope :rubyists, :in => {:interests => ['ruby']}
+ named_scope :contract_work, :in => {:interests => ['contract work']}
+ named_scope :in_state, lambda {|state| { :where => {'addresses.state' => state}}}
end